ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

IMU-Data from *.bag-File

asked 2023-01-06 09:29:58 -0500

exitus85 gravatar image

updated 2023-01-07 07:39:08 -0500

Mike Scheutzow gravatar image

Hey there,

I'm sitting here since hours and can't get the information i want to. How I'm trying to: First of all: I'm using Matlab and the Toolbox for ROS. I have a File which is called "xyz.bag" and i want to save the startTime, the angularvelocity, linearacceleration and the rostime in some variables of a new struct.

I tried it like this:

bag.Rosbag = rosbag('xyz.bag');

bag.imutopic = select(bag.Rosbag, 'Topic', 'vectornav/IMU');

imu_data = read_imudata_from_rosbag(bag)

function imu_data=read_imudata_from_rosbag(bag)
  imu_data.startTime = ???    <-- tried with bag.Rosbag.StartTime (hadn't worked up to yet) and a lot more function like readMessages an so on
  imu_data.angularvelocity = ???  <-- how to get this one? 
  imu_data.linearacceleration = ??? <--- <-- how to get this one? 
  imu_data.rostime = ??? <--- <-- how to get this one?

Could you help me to get a solution for it? I'm really trying to understand it but i don't know how to get further. It's frustrating no to get any step further.

Thank you very much for every help.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2023-01-08 09:05:35 -0500

Mike Scheutzow gravatar image

The message type published on that topic is usually sensor_msgs/Imu. If you have ros installed, the Terminal command

rosmsg info sensor_msgs/Imu

will display the format of that message (field names). If you don't have ros installed, you can do a web search for the information.

edit flag offensive delete link more


Thanks for that answer. I will give it a try and keep you informed.

exitus85 gravatar image exitus85  ( 2023-01-09 11:57:32 -0500 )edit

answered 2023-01-08 11:05:11 -0500

ljaniec gravatar image

If you just want to see this data, you can use the online option:

You can also check out possible conversions to other formats, which may be easier for you.

edit flag offensive delete link more


Thank you, i will have a look to this address.

exitus85 gravatar image exitus85  ( 2023-01-09 12:15:43 -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


Asked: 2023-01-06 09:29:58 -0500

Seen: 148 times

Last updated: Jan 08