ROS 2 Tutorials: Dockerized approach, topics not showing locally

I’m successfully able to launch the ROSBOT_SIM but I don’t see any topics on my local machine. I’m running Ubuntu 22 with ROS 2 Humble. Do I need to change
RMW_IMPLEMENTATION=rmw_cyclonedds_cpp or CYCLONEDDS_URI?

Are you assuming we should run everything inside the docker container?
docker exec -ti demo-rosbot_xl-1 bash -l

1 Like

Hello @nicholaschan23,

I’ve added a changes that should fix the issue with topic communication from docker to host. Please delete the rosbot-xl-docker folder and download it again or simply download the changes from git.

As for the missing alias, it looks like you skipped a step in ROS 2 Introduction | Husarion. According to the instructions, the folder should be downloaded to the user’s home directory.

Let me know if the problem has been solved

Thank you!

I have the ROBOT_SIM alias. This line opens a shell in the docker container because I couldn’t access topics on my host machine: docker exec -ti demo-rosbot_xl-1 bash -l

`

Hi @RafalGorecki, in my case I can see the topics with ros2 topic list command, but I am not able to get any actual topic content through to the host.

For instance ros2 topic echo on any topic would not work and wait indefinitely, and when opening rviz on the host, you have access to the topic list as well, but it does not display anything (including the image example mentioned in the first tutorial).

When running ros2 topic echo from the within the container instance, it keeps trowing errors regardless which topic is tested (see below):

ros2 topic echo /clock
Traceback (most recent call last):
File “/opt/ros/humble/bin/ros2”, line 33, in
sys.exit(load_entry_point(‘ros2cli==0.18.7’, ‘console_scripts’, ‘ros2’)())
File “/opt/ros/humble/lib/python3.10/site-packages/ros2cli/cli.py”, line 89, in main
rc = extension.main(parser=parser, args=args)
File “/opt/ros/humble/lib/python3.10/site-packages/ros2topic/command/topic.py”, line 41, in main
return extension.main(args=args)
File “/opt/ros/humble/lib/python3.10/site-packages/ros2topic/verb/echo.py”, line 220, in main
qos_profile = self.choose_qos(node, args)
File “/opt/ros/humble/lib/python3.10/site-packages/ros2topic/verb/echo.py”, line 146, in choose_qos
pubs_info = node.get_publishers_info_by_topic(args.topic_name)
File “/usr/lib/python3.10/xmlrpc/client.py”, line 1122, in call
return self.__send(self.__name, args)
File “/usr/lib/python3.10/xmlrpc/client.py”, line 1464, in __request
response = self.__transport.request(
File “/usr/lib/python3.10/xmlrpc/client.py”, line 1166, in request
return self.single_request(host, handler, request_body, verbose)
File “/usr/lib/python3.10/xmlrpc/client.py”, line 1182, in single_request
return self.parse_response(resp)
File “/usr/lib/python3.10/xmlrpc/client.py”, line 1348, in parse_response
p.feed(data)
File “/usr/lib/python3.10/xmlrpc/client.py”, line 451, in feed
self._parser.Parse(data, False)
File “…/Modules/pyexpat.c”, line 416, in StartElement
File “/usr/lib/python3.10/xmlrpc/client.py”, line 689, in start
raise ResponseError(“unknown tag %r” % tag)
xmlrpc.client.ResponseError: ResponseError(“unknown tag ‘rclpy.type_hash.TypeHash’”)

On the other hand, running an Rviz container instance alongside the one launch via ROSBOT_SIM provides access to the image topic /camera/color/image_raw, so there is still some content being communicated within docker containers instances. To display some other data type (LIDAR points, …) you need to change the fixed frame to something different than map as this is missing in the model. So data are accessible within the container but not from the host, while I thought the topic content would still be accessible from host as well.

Thank you,

Nicolas

@nicholaschan23
I can reproduce the issue. I could not see the messages after ros2 topic echo.
I fixed that exporting RMW_IMPLEMENTATION:

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ros2 topic echo /rosbot_xl_base_controller/odom
ros2 topic echo /clock

@Nico2025
In your case I recommend you to restart the ros2 daemon.

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

ros2 daemon stop
ros2 daemon start

ros2 topic echo /rosbot_xl_base_controller/odom
ros2 topic echo /clock

Also I can see the visualization inside rviz2.

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
rviz2

Please let me know if it worked for you.

Best regards,
Jakub Delicat

Hi @JakubDelicat ,

I followed the export recommendation and got the issue similar to Error getting RMW implementation identifier · Issue #478 · ros2/rmw_cyclonedds · GitHub (could not use ros 2 command anymore without showing that error).
I did sudo apt-get install -y ros-humble-rmw-cyclonedds-cpp to fix that (actually sudo apt-get install -y ros-jazzy-rmw-cyclonedds-cpp).

Then I did ros2 daemon stop / ros2 daemon start while the container image was not running.

After the export, the command ros2 topic list still works. but ros2 topic echo sometime works, sometime crash (on the IMU topic for instance) and sometime does not show the topic content such as in /clock and send back the following warning message:

[WARN] [1745985093.075221788] [rmw_cyclonedds_cpp]: Failed to parse type hash for topic ‘rt/clock’ with type ‘rosgraph_msgs::msg::dds_::Clock_’ from USER_DATA ‘(null)’

While crashing, it closes the gazebo window from the container in ROSBOT_SIM and sometime kill all applications on the monitor associated to Gazebo from the container.

So there is a bit of progress but still not fully working I would say.

Thanks,

Nicolas

I see that you are using Jazzy and Humble in the same time. Unluckily, these 2 versions of ROS are not compatible using cyclonedds. You have to use only Humble or only Jazzy.

Best Regards,
Jakub Delicat

Hey! I had a similar issue when running ROS 2 nodes inside Docker…turned out it was a networking problem. Make sure your container is using host networking (–net=host) if you’re on Linux. Also check that ROS_DOMAIN_ID is the same inside and outside the container. Once I matched those, the topics started showing up correctly with ros2 topic list.

Hope that helps!