Ask Your Question
0

Where is magnetometer measurements in the IMU messages

asked 2018-10-12 18:47:28 -0600

frodyteen gravatar image

I am using ros indigo, working with a MIDG II GPS/INS sensor using this python wrapper, I am able to produce a IMU message, but where is the magnetometer data?

header: 
  seq: 3489
  stamp: 
    secs: 1538864664
    nsecs: 333019018
  frame_id: MIDG_base_frame
orientation: 
  x: -0.0243242513388
  y: 0.0113927619532
  z: -0.242603212595
  w: 0.969753742218
orientation_covariance: [0.0005, 0.0, 0.0, 0.0, 0.0005, 0.0, 0.0, 0.0, 0.0005]
angular_velocity: 
  x: 0.0160570291183
  y: -0.0315904594611
  z: -0.000174532925199
angular_velocity_covariance: [0.0005, 0.0, 0.0, 0.0, 0.0005, 0.0, 0.0, 0.0, 0.0005]
linear_acceleration: 
  x: 0.9799096177
  y: 0.470356616496
  z: -9.75010069612
linear_acceleration_covariance: [0.0005, 0.0, 0.0, 0.0, 0.0005, 0.0, 0.0, 0.0, 0.0005]

How would I get magnetometer data if I need it?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2018-10-13 04:12:48 -0600

Fundamentally an inertial measurement doesn't include the magnetic field. In practice the orientation of the sensor is estimated from both the magnetometer and the inertial sensors, so this message only includes a derived orientation estimate not the original magnetic field measurements.

There is the sensor_msgs/MagneticField message type but I'm not sure if all the IMU driver nodes support publishing this as well as the IMU message. This is probably what you're looking for but it isn't as commonly supported.

edit flag offensive delete link more

Comments

There is the sensor_msgs/MagneticField message type but I'm not sure if all the IMU driver nodes support publishing this as well as the IMU message

this will indeed depend on whether the driver supports it, but it is the message type to use for this sort of information.

gvdhoorn gravatar imagegvdhoorn ( 2018-10-13 05:29:31 -0600 )edit

thank you for you folks' answer!

frodyteen gravatar imagefrodyteen ( 2018-10-14 21:38:23 -0600 )edit
0

answered 2018-10-12 20:16:25 -0600

billy gravatar image

updated 2018-10-12 20:17:43 -0600

orientation - wave a magnet near the IMU to confirm orientation changes

edit flag offensive delete link more

Comments

yeah, it's changing slightly, I am wondering why the magnetometer me measurement is giving in quarteron instead of just magnetic field of x y, z?

frodyteen gravatar imagefrodyteen ( 2018-10-12 20:52:58 -0600 )edit

For those wondering the same thing, sometimes IMUs will not give the magnetic field but rather the magnetic vector. If you see that your "field" is in arbitrary units then, this is the case for your sensor.

JustinBlack02 gravatar imageJustinBlack02 ( 2019-04-03 10:58:14 -0600 )edit
0

answered 2018-12-18 20:51:02 -0600

Dyson sphere gravatar image

Short answer is that the current python wrapper (driver) is not capable of providing you with magnetometer date, but only with the data you originally received (and some other data you are not using).

Long answer: The reason why you are not receiving magnetometer data is because the python wrapper you are using doesn't have this reading. If you look at the source code you can see it reads data from message frame with ID number 10 (also frame with ID number 12, 13 and 20 but these are not relevant for your test). In the MIDG II user manual on page 22 you can find that the frame for magnetometer reading is message frame with the ID number 3. This in term means that the python driver is processing navigation sensor data found in message frame number 10 and publishes it as a sensor_msgs/Imu message (the one you received) without the magnetometer data as this data is never even processed. Other aforementioned frames are also being processed but only GPS data is being published.

Easier solution for your problem is to use a different driver which indeed does have that reading, but I am not aware if there any for python. A bit trickier solution is to change the python driver itself and add this functionality and then publish it to a different topic as PeteBlackerThe3rd mentioned, maybe also creating your own message type with all sensor data you need (depending on the use case). This is not a hard problem to solve (as much can be learned from reading the existing code and provided user manual) but it can be tricky if you never did it by yourself.

edit flag offensive delete link more

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: 2018-10-12 18:47:28 -0600

Seen: 412 times

Last updated: Oct 13 '18