Skip to content

Instantly share code, notes, and snippets.

View bgromov's full-sized avatar

Boris Gromov bgromov

View GitHub Profile
@bgromov
bgromov / test_spinner.cpp
Last active May 15, 2023 13:50
Demonstrates the use of AsyncSpinner and custom callback queue in ROS
#include <ros/ros.h>
#include <ros/spinner.h>
#include <ros/callback_queue.h>
#include <std_msgs/Empty.h>
#include <std_msgs/Bool.h>
boost::shared_ptr<ros::AsyncSpinner> g_spinner;
bool g_enable = false;
@bgromov
bgromov / test_spinner2.cpp
Created May 25, 2016 17:29
Demonstrates the use of AsyncSpinner and custom callback queue in ROS. Uses custom queue for enable/disable topic and global for heartbeats.
#include <ros/ros.h>
#include <ros/spinner.h>
#include <ros/callback_queue.h>
#include <std_msgs/Empty.h>
#include <std_msgs/Bool.h>
boost::shared_ptr<ros::AsyncSpinner> g_spinner;
bool g_enable = false;
@bgromov
bgromov / gist:4cda45a17c60387ba002e10e7be581a1
Created June 20, 2016 00:50
Using ROS robot_upstart with whatever IP address available on wlan0 interface
rosrun robot_upstart install hmri_bringup/launch/bringup.launch --master http://"\$(ip addr show wlan0 | grep \"inet\b\" | awk '{print \$2}' | cut -d/ -f1)":11311 --user root
@bgromov
bgromov / docker_cleanup_aliases.sh
Last active June 23, 2016 16:41
Docker Cleanup Commands
#!/bin/bash
# E.g. ~/.bash_aliases
## Docker Cleanup Commands
## Credits: https://www.calazan.com/docker-cleanup-commands/
# Kill all running containers
alias docker_kill='docker kill $(docker ps -q)'
@bgromov
bgromov / where_am_i.sh
Created June 23, 2016 16:22
One-liner to determine scripts own location. No matter where it is called from. (Doesn't work with symlinks)
#!/bin/bash
# Credits: http://stackoverflow.com/a/246128
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Where am I?!"
echo -e "I am here: ${DIR}"
@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@bgromov
bgromov / PyQt5_with_SIP4_and_virtualenv.md
Last active August 17, 2021 03:12
PyQt5 with SIP 4.19.1 for Python 2.7 with virtualenv under macOS Sierra

Preparation

Install Qt5 with homebrew and link it to the system (potentially destructive operation):

$ brew install qt5
$ brew unlink qt # may fail if no Qt4 was installed previously with homebrew
$ brew link --force qt5

Additionally, it might be worth to activate the appropriate target virtualenv with:

@bgromov
bgromov / ros_kinetic_macos_sierra_10.12.md
Last active January 18, 2021 19:34
ROS Kinetic on macOS Sierra 10.12

Troubleshooting

OpenCV3

  1. Qt5::Core (/usr/local/.//mkspecs/macx-clang does not exist)
CMake Error at /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:17 (message):
  The imported target "Qt5::Core" references the file

"/usr/local/.//mkspecs/macx-clang"
#!/bin/bash
mkdir tmp
cd tmp
# the two lines below will fail in case it's not the first time we clone
git clone https://github.com/Itseez/opencv.git
git clone https://github.com/Itseez/opencv_contrib.git
# revert the main CMakeLists.txt file in case it's not the first time
cd opencv
git clean -dxf
@bgromov
bgromov / ros_env.sh
Created March 6, 2018 23:44
ROS environment with IP from the main network interface
#!/bin/bash
NET_IF=`netstat -rn | awk '/^0.0.0.0/ {thif=substr($0,74,10); print thif;} /^default.*UG/ {thif=substr($0,65,10); print thif;}'`
PRIMARY_NET_IF=($NET_IF)
export ROS_IP=`ifconfig ${PRIMARY_NET_IF[0]} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
if [ -z ${ROS_IP} ]
then
export ROS_IP=127.0.0.1
fi