ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Error when change the sensor message from custom one to standard

asked 2022-10-27 04:46:18 -0500

Astronaut gravatar image

Hi

I changed some ROS2 nodes so can use standard IMU sensor messages defined in ROS as standard sensor IMU message instead of custom one . I defined correctly the IMU sensor message in the message file. Also in the python3 code I have imported correctly with from sensor_msgs.msg import Imu.. So, somewhere in my python code I would like to use this standard sensor message . When I execute the launch file with

ros2 launch system_launch test_system_launch.py

I got the following ERROR

 [ERROR] [1666862786.571709059] [rosbag2_transport]: Topic '/robot/imu' has several types associated. Only topics with one type are supported

I think have to check the publishers of the /robot/imu topic Which nodes publishes and which message types.. But not sure is the right way to find out the error and how to do it. Any help ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-27 07:31:53 -0500

nils_iseke gravatar image

updated 2022-10-28 04:07:54 -0500

It seems that you try to publish on one topic with two different publishers using two different message types. Because you said:

I defined correctly the IMU sensor message in the message file.

I am assuming that you created a custom message with the same field types as the sensor_msgs/Imu message? The message type is distinguished through the name of the message. Therefore the types of your custom imu message and the default message are different, which is causing the error.

You can execute: ros2 topic info /robot/imu to see which returns the message type of the topic.

edit flag offensive delete link more

Comments

yes exactly , I created a message myself that is structured in the same way as the sensor_msgs/Imu Message. how to check the message types of the publishers that publish to the topic /robot/imu ? you mean check the nodes that publish that topic /robot/imu?

Astronaut gravatar image Astronaut  ( 2022-10-27 09:33:45 -0500 )edit

So i don't get why you are not using the sensor_msgs/Imu everywhere? I would assume if you do so, it would resolve the issue. Yes check the message type of each publisher that publishes to /robot/imu in your code and change them all to the official sensor_msgs/Imu message.

nils_iseke gravatar image nils_iseke  ( 2022-10-27 11:34:01 -0500 )edit

to point is if possible to keep both, means custom sensor_msg/CustomImu and standard sensor_msg/Imu. Is that possible?

Astronaut gravatar image Astronaut  ( 2022-10-27 21:23:16 -0500 )edit

updated my awnser, hope that helps :)

nils_iseke gravatar image nils_iseke  ( 2022-10-28 04:08:22 -0500 )edit

when run ros2 topic info /robot/imu I got this: Type: sensor_msgs/msg/Imu Publisher count: 1 Subscription count: 0

So means only one publisher? how to find him?

Astronaut gravatar image Astronaut  ( 2022-10-30 21:26:16 -0500 )edit

I would assume that the second publisher (the one with the custom message), is not running because of the error. So therefore just one publisher is found. To find a publisher go through the executables which are called by your launchfile test_system_launch.py and then search for the publisher that publish to "/robot/imu", change the message type of all those publishers to the same message type.

nils_iseke gravatar image nils_iseke  ( 2022-11-01 14:26:27 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-27 04:46:18 -0500

Seen: 1,910 times

Last updated: Oct 28 '22