This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<launch> | |
<arg name="foo"/> | |
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" | |
output="screen" > | |
<param name="video_device" value="/dev/video0" /> | |
<param name="image_width" value="640" /> | |
<param name="image_height" value="480" /> | |
<param name="pixel_format" value="mjpeg" /> | |
<param name="camera_frame_id" value="usb_cam" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to install packages from github | |
git clone -b <branch> <address> | |
e.g. git clone -b hydro-devel https://github.com/ros/common_msgs.git | |
What python version I ahve installed? | |
pkg-config --modversion opencv | |
How to view a camera topic on ROS? | |
rosrun image_view image_view image:=/usb_cam/image_rect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to download all Gazebo models | |
Gazebo is a wonderful simulation tool widely used in robotics projects. The project includes a library of 3D models that are automatically downloaded on demand. However this makes the application pause each time a model is used for the first time, which can take a considerable time depending on connection speed and interfere with the flow of work. | |
In order to avoid this issue I wrote the below script to do a bulk download of all models in the Gazebo library, then copy them to the local model folder. Simply copy the lines below to a script file on a convenient local folder and run it from a command prompt. | |
#!/bin/sh | |
# Download all model archive files | |
wget -l 2 -nc -r "http://models.gazebosim.org/" --accept gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include "board.h" | |
#include "msg.h" | |
#include "thread.h" | |
#include "periph/uart.h" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from StringIO import StringIO # Python2 | |
from io import StringIO # Python3 | |
import sys | |
# Store the reference, in case you want to show things again in standard output | |
old_stdout = sys.stdout | |
# This variable will store everything that is sent to the standard output | |
result = StringIO() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have setup Ad-Hoc mode on my Pi3. | |
This involves modification to network configuration file /etc/network/interfaces so you should first make a backup e.g. sudo cp /etc/network/interfaces /etc/network/interfaces.orig. | |
Replace the interfaces file with the following:- | |
# interfaces(5) file used by ifup(8) and ifdown(8) | |
# Please note that this file is written to be used with dhcpcd | |
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ROS1 | |
export ROS_DISTRO=melodic | |
source /opt/ros/$ROS_DISTRO/setup.bash | |
source /home/user/catkin_ws/devel/setup.bash | |
# ROS2 | |
export ROS_DISTRO=crystal | |
source /opt/ros/$ROS_DISTRO/setup.bash | |
source /home/user/ros2_ws/install/local_setup.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <thread> | |
#include <future> | |
std::mutex g_display_mutex; | |
// function for threads | |
void accumulator_function(const std::vector<int> &v, unsigned long long &acm, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class Switchable { | |
public: | |
virtual void on() = 0; | |
virtual void off() = 0; | |
}; | |
class Switch { | |
private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <array> | |
#include <algorithm> | |
#include <iostream> | |
class MyType { | |
public: | |
MyType() = default; | |
MyType(int item):item_{item} | |
{ } |
OlderNewer