Skip to content

Instantly share code, notes, and snippets.

View peci1's full-sized avatar

Martin Pecka peci1

  • Czech Technical University in Prague
  • Czech republic
View GitHub Profile
@peci1
peci1 / path_tracer.sh
Created October 26, 2020 13:59
Launcher for path_tracer subt script that automatically records a video, autoconfigures the top-view camera to view exactly the explored space, zooms out several levels in the end to show the whole world, and repeats the last frames of the video a few times for easier inspection of what the state was in the very end.
#!/bin/bash
[ $# -lt 1 ] && echo "Provide path to simulator logs" && exit 1
dir=$1
[ ! -f "${dir}/state.tlog" ] && echo "The given path is incorrect, it doesn't contain file state.tlog" && exit 1
tracer_conf="${dir}/../../path_tracer.yml"
[ $# -gt 1 ] && tracer_conf="$2"
@peci1
peci1 / subt_cuda.Dockerfile
Last active January 6, 2021 19:33
Dockerfile combining SubT virtual testbed images with CUDA support
FROM osrf/subt-virtual-testbed:cloudsim_bridge_latest
RUN curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | sudo apt-key add - && echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list && echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/nvidia-ml.list && sudo apt-get -yy update
ARG cuda_maj=10
ARG cuda_min=0
ARG cuda=$cuda_maj-$cuda_min
ARG cudnn=7
RUN sudo apt-get install -y --no-install-recommends cuda-cudart-$cuda cuda-compat-$cuda cuda-libraries-$cuda cuda-npp-$cuda cuda-nvtx-$cuda cuda-cublas-$cuda libnccl2="*+cuda$cuda_maj.$cuda_min" libcudnn$cudnn="$cudnn.*+cuda$cuda_maj.$cuda_min" && sudo apt-get clean && sudo apt-mark hold libnccl2 && sudo apt-mark hold libcudnn$cudnn && sudo ln -s cuda-$cuda /usr/local/cuda && echo "/usr/local/nvidia/lib" | sudo tee /etc/ld.so.conf.d/nvidia.con
@peci1
peci1 / Install.md
Last active April 8, 2022 01:03
Install Ubuntu 18.04 on Lenovo T14s AMD with Ryzen 7 PRO 4750U CPU and AMD Renoir GPU

Ubuntu 18.04 on Lenovo T14s

What's the problem?

The Ryzen CPU and Renoir GPU are too new for all kernels supported by Ubuntu 18.04 (5.4 is the latest supported). The notebook will boot with 18.04.5, but a lot of things will not work (sleep, screen brightess, audio, graphics only works in a limited way etc.).

This tutorial shows the steps necessary to be done to successfully run the system with full support for the GPU and other peripherals.

Steps

@peci1
peci1 / ignition-dome.yaml
Created May 1, 2021 17:23
/etc/ros/rosdep/sources.list.d/ignition-dome.yaml
ignition-dome:
ubuntu: [ignition-dome]
ignition-cmake2:
ubuntu: [libignition-cmake2-dev]
ignition-common3:
ubuntu: [libignition-common3-dev]
ignition-fuel-tools5:
ubuntu: [libignition-fuel-tools5-dev]
ignition-gazebo4:
ubuntu: [libignition-gazebo4-dev]
@peci1
peci1 / path_tracer.sh
Created October 27, 2021 12:07
subt virtual path_tracer launcher script
#!/bin/bash
[ $# -lt 1 ] && echo "Provide path to simulator logs" && exit 1
dir="$1"
[ ! -f "${dir}/state.tlog" ] && echo "The given path is incorrect, it doesn't contain file state.tlog" && exit 1
tracer_conf="$(d="${dir}"; while [ "$d" != "/" ]; do if [ -f "${d}/path_tracer.yml" ]; then echo "${d}/path_tracer.yml"; break; else d="$(dirname "$d")"; fi; done)"
[ -z "${tracer_conf}" ] && echo "path_tracer.yml not found in the given or any parent directory" >&2 && exit 1
@peci1
peci1 / ptp_test.py
Last active May 6, 2023 04:07
This is a script for testing whether a switch fills the correction field in relevant PTPv2 messages.
"""
This is a script for testing whether a switch fills the correction field in relevant PTPv2 messages.
The following combinations of message types and two-step clock should get the correction field filled:
| TYPE | 2-STEP |
| SYNC | 0 |
| DELAY_RESP | - |
| FOLLOW_UP | - |
| PDELAY_RESP | 0 |
| PDELAY_FOLLOW_UP | - |
I.e. SYNC and PDELAY_RESP with TWO_STEP=1 can have zero correction.
@peci1
peci1 / sync_watch.py
Last active March 29, 2022 14:32
A watchdog of PTP sync written on top of libpmc
"""
This program continuously checks whether a PTP client is well synced to its master.
SPDX-License-Identifier: BSD-3-Clause
SPDX-FileCopyrightText: Czech Technical University in Prague
"""
import argparse
import contextlib
from math import ceil
from typing import Tuple, List, Optional
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation, ImageMagickWriter
from matplotlib.collections import Collection
from matplotlib.container import Container
from matplotlib.patches import Patch
@peci1
peci1 / _etc_apache2_mods-enabled_rewrite.load
Last active June 29, 2022 23:26
Hide the network interface created by Emlid Reach M+ GPS when you connect it via USB (tested on Ubuntu 18.04/systemd)
# Only add this if you need to run Apache on the host
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
@peci1
peci1 / gblox.py
Created May 24, 2022 10:44
Test of VSC7511 packet mangling bug
# Run "iperf3 -s" on "Computer 1" and "python3 gblox.py 10000 IP_OF_OTHER_COMPUTER_1" on "Computer 2".
# Run wireshark on Computer 2 and watch the packets arriving on port 5201.
# You will see all IP packets except the first in each UDP transmission have mangled 4 bytes
# near the beginning of their data sections. The test program shoud send repeated patterns of
# 0123456789abcdef, so it should be quite easy to spot. The 00 at position 7 and 8 is always
# there, 69 on the second blue line is also always there, while 87 seems to be randomly changing.
import socket
import sys