ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
To only run the callback once, you can do something similar to:
class Example:
def __init__(self):
self.sub = rospy.Subscriber(..., self.cb, ...)
def cb(self, msg):
# do something with msg
self.sub.unregister()
2 | No.2 Revision |
To only run the callback once, you can do something similar to:
class Example:
def __init__(self):
self.sub = rospy.Subscriber(..., self.cb, ...)
def cb(self, msg):
# do something with msg
self.sub.unregister()
3 | No.3 Revision |
To only run the callback once, you can do something similar to:
class Example:
def __init__(self):
self.sub = rospy.Subscriber(..., self.cb, ...)
def cb(self, msg):
# do something with msg
self.sub.unregister()
4 | No.4 Revision |
To only run the callback once, you can do something similar to:The easiest way is to use:
msg = rospy.wait_for_message('/example_topic', ExampleMsg)
.
class Example:
def __init__(self):
self.sub = rospy.Subscriber(..., self.cb, ...)
def cb(self, msg):
# do something with msg
self.sub.unregister()
5 | No.5 Revision |
The In rospy, the easiest way is to use:
use (as gvdhoorn suggests):
msg = rospy.wait_for_message('/example_topic', ExampleMsg)
.
6 | No.6 Revision |
In rospy, the easiest way is to use (as gvdhoorn suggests):
suggests):
msg = rospy.wait_for_message('/example_topic', ExampleMsg)
.