Skip to main content

5.1.5 Using ROS2 Packages

Prerequisite: TogetheROS.Bot has been successfully installed.

tros.b is fully compatible with ROS2 Foxy/Humble/Jazzy interfaces and can reuse rich ROS2 tool packages. Here we use installing and using ROS2 image-transport as an example to introduce how to use ROS packages in tros.b.

Installing ROS2 Packages

1 Add ROS apt Source

When installing tros.b, the ROS apt source is automatically added. No manual addition is required.

Update apt repository

sudo apt update
Note

If the sudo apt update command fails or reports an error, please refer to the FAQ section Q10: How to handle apt update command failure or error? for resolution.

Note

If the sudo apt update command fails or reports an error, please refer to the FAQ section Q10: How to handle apt update command failure or error? for resolution.

Note

If the sudo apt update command fails or reports an error, please refer to the FAQ section Q6: How to handle apt update command failure or error? for resolution.

Note

If the sudo apt update command fails or reports an error, please refer to the FAQ section Q6: How to handle apt update command failure or error? for resolution.

2 Install Packages

sudo apt install ros-foxy-image-transport
sudo apt install ros-foxy-image-transport-plugins
sudo apt install ros-humble-image-transport
sudo apt install ros-humble-image-transport-plugins
sudo apt install ros-jazzy-image-transport
sudo apt install ros-jazzy-image-transport-plugins

Using ROS2 Packages

Same as using ROS

source /opt/tros/setup.bash
ros2 run image_transport list_transports
source /opt/tros/humble/setup.bash
ros2 run image_transport list_transports
source /opt/tros/jazzy/setup.bash
ros2 run image_transport list_transports

The running result is as follows, showing the image formats supported by the image_transport package

root@ubuntu:/opt/tros# ros2 run image_transport list_transports
Declared transports:
image_transport/compressed
image_transport/compressedDepth
image_transport/raw
image_transport/theora

Details:
----------
"image_transport/compressed"
- Provided by package: compressed_image_transport
- Publisher:
This plugin publishes a CompressedImage using either JPEG or PNG compression.

- Subscriber:
This plugin decompresses a CompressedImage topic.

----------
"image_transport/compressedDepth"
- Provided by package: compressed_depth_image_transport
- Publisher:
This plugin publishes a compressed depth images using PNG compression.

- Subscriber:
This plugin decodes a compressed depth images.

----------
"image_transport/raw"
- Provided by package: image_transport
- Publisher:
This is the default publisher. It publishes the Image as-is on the base topic.

- Subscriber:
This is the default pass-through subscriber for topics of type sensor_msgs/Image.

----------
"image_transport/theora"
- Provided by package: theora_image_transport
- Publisher:
This plugin publishes a video packet stream encoded using Theora.

- Subscriber:
This plugin decodes a video packet stream encoded using Theora.