ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
To make it really concrete: the following should print the time t
at which message msg
was recorded followed by the contents for each message received on the topic /robo_explorer/loadcell
:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
if topic == "/robo_explorer/loadcell":
print ("{t}: '{msg}'")
2 | No.2 Revision |
To make it really concrete: the following should print the time t
at which message msg
was recorded followed by the contents for each message received on the topic /robo_explorer/loadcell
:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
if topic == "/robo_explorer/loadcell":
print ("{t}: '{msg}'")
(haven't checked the syntax, so there may be errors)
That would be the best you could do in the absence of a std_msgs/Header
field.
And note again: this would get you time at which the message was recorded, not when it was published.
3 | No.3 Revision |
To make it really concrete: the following should print the time t
at which message msg
was recorded followed by the contents for each message received on the topic /robo_explorer/loadcell
:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
if topic == "/robo_explorer/loadcell":
print ("{t}: (f"{t}: '{msg}'")
(haven't checked the syntax, so there may be errors)
That would be the best you could do in the absence of a std_msgs/Header
field.
And note again: this would get you time at which the message was recorded, not when it was published.