Unable to see /odom topic in ros2


I’ve run in Shell 1

source ~/.bashrc_bridge
ros2 run ros1_bridge dynamic_bridge

In Shell 2, I get below error.

user:~/ros2_ws$ ros2 topic echo /odom nav_msgs/msg/Odometry
Traceback (most recent call last):
  File "/opt/ros/foxy/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.9.7', 'console_scripts', 'ros2')()
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2topic/command/topic.py", line 41, in main
    return extension.main(args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2topic/verb/echo.py", line 81, in main
    return main(args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2topic/verb/echo.py", line 97, in main
    message_type = get_message(args.message_type)
  File "/opt/ros/foxy/lib/python3.8/site-packages/rosidl_runtime_py/utilities.py", line 30, in get_message
    raise ValueError("Expected the full name of a message, got '{}'".format(identifier))
ValueError: Expected the full name of a message, got 'nav_msgs/msg/Odometry'

Any idea why ?

Hello, firstly, I’m also a ROS newbie.

Secondly, is the topic listed under ros2 topic list?

I had (have) a similar question asking why /cmd_vel is not listed under topic list - but of course it makes sense that if it’s not listed you cannot ‘echo’ it…

Hi, do you have the simulation running? Can you see the output of ros2 topic list?

I noticed that you reserved the real robot lab, however we had a cable disconnect over the weekend so the robot wasn’t powered, maybe that is the issue you encountered. I will attend to the robot and let you know when it is ready to reserve again.

Thank you,

OK, thanks for the info. I just wanted to solve the exercise, We should be able to receive /odom data without real robots right ?

user:~/ros2_ws$ ros2 topic list

Basically I am unable to list /odom topic, despite running ros1 bridge. Do I have to run some node that publishes it ? As per the notes in Exercise 5.2, there is no such step required. Please confirm. Thanks.

Hello @msp ,

By default, the dynamic_bridge doesn’t bridge all the topics available, only the ones that have a publisher-subscriber connection. That’s why you won’t be able to see the topic (with a ros2 topic list) until you create a subscriber for it. I’ve been doing some tests here and it should work OK.

Shell 1:

source .bashrc_bridge
ros2 run ros1_bridge dynamic_bridge

Shell 2:

source .bashrc_ros2
ros2 topic echo /odom nav_msgs/msg/Odometry

When you run the echo command in Shell 2, this is the same as creating a subscriber for the topic, so the bridge is now created for the /odom topic. You should see a message like this now in the bridge Shell output:

created 1to2 bridge for topic '/odom' with ROS 1 type 'nav_msgs/Odometry' and ROS 2 type 'nav_msgs/msg/Odometry'

An alternative is to run the dynamic_bridge with the following arguments:

ros2 run ros1_bridge dynamic_bridge --bridge-all-topics

With this bridge-all-topics argument you will bridge all the topics automatically, so you will be able to see the odom topic (with a ros2 topic list) directly.

Does all this make sense?


Thank you so much @albertoezquerro . That was very useful info. IMO, it may be worth to add this in the course for beginners.

1 Like