Frequent Asked Question...
Tbot custom topic types (beep, buttom, etc.)
I cannot echo topics provided by the tbot such /events/button
or /events/bumper
because the type isn't recognized.
To install those custom types:
cd $ROS_WORKSPACE
git clone https://github.com/imt-mobisyst/pkg-interfaces.git
colcon build --base-path pkg-interfaces
source ./install/setup.bash
Example of Marker publishing (4 spheres)
from visualization_msgs.msg import Marker
from std_msgs.msg import ColorRGBA
[...]
def publish_markers(self):
# List of marker positions, for example
marker_positions = [
(1.0, 2.0, 0.5),
(2.0, 1.0, 0.5),
(0.0, -2.0, 1.0),
(-1.5, -1.5, 0.5)
]
# Loop over the positions to create markers
for idx, (x, y, z) in enumerate(marker_positions):
marker = Marker()
marker.header.frame_id = "map" # Frame of reference (use 'map' or other valid frame)
marker.header.stamp = myROSNode.get_clock().now().to_msg()
marker.ns = "array_of_markers"
marker.id = idx # Unique ID for each marker in the array
marker.type = Marker.SPHERE
marker.action = Marker.ADD
# Set the position of each marker
marker.pose.position.x = x
marker.pose.position.y = y
marker.pose.position.z = z
marker.pose.orientation.w = 1.0
# Set the scale of the marker (size)
marker.scale.x = 0.5
marker.scale.y = 0.5
marker.scale.z = 0.5
# Set the color of the marker (green)
marker.color = ColorRGBA(r=0.0, g=1.0, b=0.0, a=1.0)
# Publish the marker
self.my_marker_publisher.publish(marker)
# Log to confirm marker publishing
myROSNode.get_logger().info(f"Publishing marker {idx} at position: ({x}, {y}, {z})")
ROS2 tbot driver
How to get ROS2 tbot driver on my computer (to use it without a Pi)
Install:
cd $ROS_WORKSPACE
git clone https://github.com/imt-mobisyst/pkg-interfaces.git
git clone https://github.com/imt-mobisyst/pkg-tbot.git
./script/install-kobuki_ros.sh
colcon build
Launch:
# base only
ros2 launch tbot_start base.launch.py
# base + laser
ros2 launch tbot_start minimal.launch.py
# base + with laser + camera
ros2 launch tbot_start full.launch.py
ros2 topic list
Fix malformed packets
Info there: https://github.com/kobuki-base/kobuki_core/commit/2bc11a1bf0ff364b37eb812a404f124dae9c0699
sudo cp /home/bot/ros2_ws/pkg-kobuki/kobuki_core/60-kobuki.rules /lib/udev/rules.d/
Then unplug / replug the robot. To ensure it worked, the followwing command should display 1:
cat /sys/bus/usb-serial/devices/ttyUSB0/tty/ttyUSB0/device/latency_timer
-->
There is no Wifi on my dell-xps13 ?
- Connect with cable
- Get the appropriate drivers: killer driver
sudo add-apt-repository ppa:canonical-hwe-team/ backport-iwlwifi
sudo apt-get update
sudo apt-get install backport-iwlwifi-dkms
- reboot
Remove password asking for docker commands
sudo echo "\n%sudo ALL=(ALL) NOPASSWD: /usr/bin/docker\n" >> /etc/sudoers
Catkin_create_pkg - invalid email ?
you can use the -m
option to force an author name.
catin_create_pkg -m AuthorName package_name [dependencies...]
opencv_createsamples
The latest OpenCV does not include opencv_createsamples
.
Let's compile an older version (~5 min on labs PC).
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 3.4.17
mkdir build
cd build
cmake -D'CMAKE_BUILD_TYPE=RELEASE' ..
make -j8
ls -l bin/opencv_createsamples
How to get an aligned depth image to the color image ?
you can use the align_depth:=true
ROS parameter. The aligned image is streamed in a specific topic. (tks Orange group)
roslaunch realsense2_camera rs_camera.launch align_depth:=true
ROS1 vs ROS2 commands cheatsheet
ROS1 | ROS2 |
---|---|
rostopic list |
ros2 topic list |
rqt_graph |
rqt_graph |
rviz |
rviz2 |
rosrun tf view_frames |
ros2 run tf2_tools view_frames |
colcon build --packages-select my_package |
|
colcon build --symlink-install |
|
colcon build --paths path/to/some/package other/path/to/other/packages/* |
|
colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_VERBOSE_MAKEFILE=ON --packages-select my_package |
.bashrc
ROS additions
# ROS
export ROS_LOCALHOST_ONLY=1
export PS1="\${ROS_VERSION:+(ros\$ROS_VERSION) }$PS1"
alias rosify1="source /opt/ros/noetic/setup.bash && source $HOME/ros1_ws/devel/setup.bash"
alias rosify2="source /opt/ros/iron/setup.bash && source $HOME/ros2_ws/install/setup.bash"
Flash kobuki
https://kobuki.readthedocs.io/en/devel/firmware.html#linux
ROS2 Package with custom Python Library
- suppose we are in packge
my-package
- Inside the package folder
my-package
create a folder for my library. For examplelibs/my_lib
- Inside
myLib
folder add__init__.py
file that imports resources from other python files. - Add the
CMakeList.txt
install( DIRECTORY libs/my_lib DESTINATION lib/${PROJECT_NAME})
- build the package
colcon build
More on ros2 tutorial by readthedocs: