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 / ros1_package_downloads_08_2022.csv
Created August 8, 2022 14:37
Number of total *.deb package downloads of all released ROS 1 packages (Melodic + Noetic)
package hits
tf2-ros 4042961
tf 4019466
tf2-py 3998899
image-transport 3805803
tf2-msgs 3794527
cv-bridge 3782526
tf2 3775665
rviz 3738507
actionlib 3727017
@peci1
peci1 / bag_extract_images.py
Last active August 2, 2022 15:23
Python script that extracts all images from a ROS BAG file into separate image files on disk
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import rosbag
import sys
try:
@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
@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
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 / 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
@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 / 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 / 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 / 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