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

Revision history [back]

You need code that receives a message of the same name, and data type as the message that is transmitted.I suspect your code currently has the same topic name, but the format it is currently looking for (String) is not the same as what is being sent.

What format is the message rtabmap/graph ?

You would need to import that message type at the top of you code, and then create a listener of that type (so that the data can be parsed correctly when it arrives).

You need code that receives a message of the same name, and data type as the message that is transmitted.I suspect your code currently has the same topic name, but the format it is currently looking for (String) is not the same as what is being sent.

What format is the message rtabmap/graph ?

You would need to import that message type at the top of you code, and then create a listener of that type (so that the data can be parsed correctly when it arrives).

I can't see a topic of that type at http://docs.ros.org/api/rtabmap_ros/html/index-msg.html but there is one called MapGraph.

Assuming there is a Graph type then at the top of the code you would import that definition rather than String

from rtabmap_ros import Graph

rather than the line that imported String

and where you setup the the subscriber

rospy.Subscriber("rtabmap/graph", Graph, callback)

Inside your callback you would now be able to access individual bits of the message using the dot notation

data.partOfMessageYouAreTryingToAccess

based on the message definition that tells you the names of the parts of the message (I can't find the definition so don't know what there is.

if that doesn't work try MapGraph

You need code that receives a message of the same name, and data type as the message that is transmitted.I suspect your code currently has the same topic name, but the format it is currently looking for (String) is not the same as what is being sent.

What format is the message rtabmap/graph ?

You would need to import that message type at the top of you code, and then create a listener of that type (so that the data can be parsed correctly when it arrives).

I can't see a topic of that type at http://docs.ros.org/api/rtabmap_ros/html/index-msg.html but there is one called MapGraph.

Assuming there is a Graph type then at the top of the code you would import that definition rather than String

from rtabmap_ros rtabmap_ros.msg import Graph

rather than the line that imported String

and where you setup the the subscriber

rospy.Subscriber("rtabmap/graph", Graph, callback)

Inside your callback you would now be able to access individual bits of the message using the dot notation

data.partOfMessageYouAreTryingToAccess

based on the message definition that tells you the names of the parts of the message (I can't find the definition so don't know what there is.

if that doesn't work try MapGraph