ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The best way to implement something like this is rospy.wait_for_message(..)
. Creating Subscriber
s in callbacks is not a good idea.
If you're really only interested in a single message (which happens to be 'the last' only because of latching) then don't create the Subscriber
, but use rospy.wait_for_message(..)
only.
2 | No.2 Revision |
The best way to implement something like this is rospy.wait_for_message(..)
. Creating Subscriber
s in callbacks is not a good idea.
If you're really only interested in a single message (which happens to be 'the last' only because of latching) then don't create the Subscriber
, but use rospy.wait_for_message(..)
only.
Note btw that what you show in your question text is really brittle: there is no way to guarantee that globvar
will contain an actual message object at that point.