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 / 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 / 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 / ground_truth_publisher.cpp
Created September 26, 2020 14:21
Subt virtual publish ground truth
#include <ignition/transport.hh>
#include <ignition/msgs/pose_v.pb.h>
#include <ros/ros.h>
#include <nav_msgs/Odometry.h>
#include <tf2_ros/transform_broadcaster.h>
#include <tf2_ros/static_transform_broadcaster.h>
class GroundTruthPublisher
{
@peci1
peci1 / Output:
Created July 1, 2020 13:54
Test of behavior when ROS subscribes to a message published using a different allocator
[ INFO]: pub1 a boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > >
[ INFO]: pub2 b boost::shared_ptr<sensor_msgs::PointCloud2_<boost::fast_pool_allocator<void, boost::default_user_allocator_new_delete, std::mutex, 32u, 0u> > >
[ INFO]: sub a boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const>
[ INFO]: Received message a is equal to p
[ INFO]: sub b boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const>
[ INFO]: Received message b is a new instance
[ WARN]: length PC2 with frame b
[ WARN]: write PC2 with frame b
[ WARN]: read PointCloud2 with frame b
@peci1
peci1 / syslog-ng.conf
Created May 28, 2020 01:09
Syslog NG config for Turris Omnia which saves important parts of the logs to NAS. Date is also unified to a single timezone for all messages.
@version:3.19
options {
chain_hostnames(no);
flush_lines(0);
stats_freq(0);
flush_lines(0);
log_msg_size(65536);
};
@peci1
peci1 / FindFilesystem.cmake
Created January 13, 2020 20:18
CMake module for using the most modern of std::filesystem, std::experimental::filesystem and boost::filesystem.
# Distributed under the OSI-approved BSD 3-Clause License.
# Base on https://github.com/vector-of-bool/CMakeCM/blob/master/modules/FindFilesystem.cmake
#[=======================================================================[.rst:
FindFilesystem
##############
This module supports the C++17 standard library's filesystem utilities. Use the
:imp-target:`std::filesystem` imported target to enable support of it.
@peci1
peci1 / clean build output
Last active August 13, 2019 08:24
gazebo build problem
Subprocess > gazebo:make `cd /media/data/gazebo/build/gazebo; catkin build --get-env gazebo | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -`
[gazebo:make] /usr/bin/cmake -H/media/data/gazebo/src/gazebo -B/media/data/gazebo/build/gazebo --check-build-system CMakeFiles/Makefile.cmake 0
[gazebo:make] /usr/bin/cmake -E cmake_progress_start /media/data/gazebo/build/gazebo/CMakeFiles /media/data/gazebo/build/gazebo/CMakeFiles/progress.marks
[gazebo:make] /usr/bin/make -f CMakeFiles/Makefile2 all
[gazebo:make] make[1]: Vstupuje se do adresáře „/media/data/gazebo/build/gazebo“
[gazebo:make] /usr/bin/make -f deps/opende/ou/CMakeFiles/gazebo_opende_ou.dir/build.make deps/opende/ou/CMakeFiles/gazebo_opende_ou.dir/depend
[gazebo:make] /us
@peci1
peci1 / check_raid_status.sh
Last active January 13, 2019 23:49
A script for Turris Omnia that checks the status of a JMicron JMS56x RAID controller and sends a notification if something's wrong.
#!/bin/bash
# Based on the script from https://forum.odroid.com/viewtopic.php?t=29298
# Changes to that script are released under BSD license (c) Martin Pecka, 2019.
# raidmgr_static can be downloaded here: https://wiki.odroid.com/_media/accessory/add-on_boards/xu4_cloudshell2/raidmgr_static_cloudshell2.zip
RAID_MANAGER="/usr/bin/raidmgr_static"
STATUS="$(echo -e "SR C0\nEX\n" | $RAID_MANAGER)"
@peci1
peci1 / revert_packages_to_ppa_versions.sh
Created January 7, 2019 12:54
Revert all packages from non-PPA versions to their latest PPA version.
#!/usr/bin/env bash
# BSD 3-clause license, copyright Martin Pecka @ 2019
# This script outputs a command that will revert all packages from non-PPA versions to their latest PPA version.
# This may be handy i.e. for finding packages for which you installed a newer version from a .deb file, or after
# incompletely removing a PPA.
export LC_ALL=C
update_deb_from_github() {
repo=$1 # will use github.com/repos/${repo}/releases, so set to e.g. BoostIO/boostnote
pkg=$2 # name of the Deiban package e.g. apt can use, so e.g. boostnote
deb_type=$3 # a substring of the deb file on github releases which uniquely tells the requested deb from other deb files on the latest releases page
version_installed=$(LANG=C aptitude show boostnote | grep Version | grep -o '[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}')
download_link=$(curl -s https://api.github.com/repos/${repo}/releases/latest | jq -r ".assets[] | .browser_download_url" | grep "${deb_type}.*\.deb")
version_upstream=$(echo ${download_link} | grep -o '[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}' | head -n1)
if [[ "${version_installed}" != "${version_upstream}" ]]; then
wget -O "/tmp/${pkg}.deb" "${download_link}"