Ask Your Question
0

Issue trying to modify bag contents with python

asked 2015-02-08 22:19:19 -0500

that_guy318 gravatar image

So I've found out that I need a frame_id in my imu message to be able to visualize it in RViz, so I've been trying to add a frame_id to the bags I have. When I try reading through the messages in the bag I keep getting an error saying "AttributeError: 'str' object has no attribute 'secs'"

Here is the code and the output from the terminal:

image description

I think I've managed to establish that the issue is to do with the itemiterator (or whatever it's called) t, but I haven't had any luck trying to cast it to the secs type.

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-02-09 00:46:16 -0500

ahendrix gravatar image

If I remember correctly, the bag.write() takes the topic name, the message and the timestamp as arguments, but you're passing the frame id as the third argument.

Instead of:

output.write(topic, msg, msg.header.frame_id)

Try using the timestamp from the original bag file:

output.write(topic, msg, t)

P.S. - Your IMU messages should probably all have the same frame ID

edit flag offensive delete link more

Comments

Awesome that worked, thanks! I couldn't find anywhere that actually said what that function was expecting. RViz is now displaying my acceleration vector too.

that_guy318 gravatar imagethat_guy318 ( 2015-02-09 05:31:49 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-02-08 22:19:19 -0500

Seen: 1,613 times

Last updated: Feb 09 '15