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

Read a msg inside a bagfile

asked 2018-04-02 23:21:19 -0500

Teddy_NTU gravatar image

In the rosbag/Code API, we could see the msg by:

 import rosbag
 bag = rosbag.Bag('test.bag')
 for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']):
     print msg
 bag.close()

When I try this, I see several msg entries. How could I select only one of entries to display?

image description

Like, for example. How could I get the data vector only?

edit retag flag offensive close merge delete

Comments

1

Please don't use an image to display text. Images are not searchable and people cannot copy and paste them.

jayess gravatar image jayess  ( 2018-04-03 00:39:00 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-04-03 00:33:50 -0500

ahendrix gravatar image

Instead of printing the whole message with print msg, do print msg.data or whichever field or fields you're interested in.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-04-02 23:21:19 -0500

Seen: 279 times

Last updated: Apr 03 '18