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

How to make rostopic listen to custom messages

asked 2011-08-14 09:10:08 -0500

David Lu gravatar image

updated 2011-08-14 16:54:13 -0500

kwc gravatar image

I've created my own message type, and have a C++ program generating messages. When I attempt to listen to the messages using rostopic echo, I get the following message.

ERROR: Cannot load message class for [mocap_msgs/LocalMocapFrame]. Are your messages built?

My messages are built and compiled. Why do I still get this error message?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2011-08-14 10:14:38 -0500

kwc gravatar image

updated 2011-08-15 04:21:55 -0500

Are you sure that rostopic is running with the same ROS_PACKAGE_PATH and that the messages are built correctly? A quick test:

#!/usr/bin/env python
import roslib
roslib.load_manifest('mocap_msgs')
import mocap_msgs.msg

print mocap_msgs.msg.LocalMocapFrame
edit flag offensive delete link more

Comments

Excellent. Thank you. Two things: 1) It should be mocap_msgs.msg.LocalMocapFrame 2) The problem was a missing dependency in the manifest. However, rosmake-ing the package showed no errors. Is that a bug?
David Lu gravatar image David Lu  ( 2011-08-15 03:26:31 -0500 )edit
sounds like a bug
kwc gravatar image kwc  ( 2011-08-15 04:22:05 -0500 )edit
0

answered 2021-06-11 07:40:48 -0500

audrius gravatar image

If you need to listen for the custom messages, you need to source devel/setup.bash first:

source devel/setup.bash
rostopic echo /generate_tool_paths/result

If you just source something like /opt/ros/noetic/setup.bash, this is enough for the simple built-in messages to work but not for others.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-08-14 09:10:08 -0500

Seen: 1,977 times

Last updated: Jun 11 '21