0
$\begingroup$

Rosanswers logo

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 http://oi60.tinypic.com/2wf4oc0.jpg

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?


Originally posted by that_guy318 on ROS Answers with karma: 25 on 2015-02-08

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by ahendrix with karma: 47576 on 2015-02-09

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by that_guy318 on 2015-02-09:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.