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

Revision history [back]

click to hide/show revision 1
initial version

The easier way to get a single message is this:

 msg = rospy.wait_for_message("my_topic", MyType)

This returns the message, and shuts down after receiving one message. You can specify a timeout as the third argument.

The easier An easy way to get a single message is this:

 msg = rospy.wait_for_message("my_topic", MyType)

This returns the message, and shuts down after receiving one message. You can specify a timeout as the third argument.argument. It also doesn't require using a global.