Serial protocol: gyroscope and magnetic field units

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
robert82h
Posts: 3
Joined: Fri May 17, 2013 3:55 pm

Serial protocol: gyroscope and magnetic field units

Post by robert82h »

I'm writing a ROS (http://www.ros.org) node that talks to MultiWii over the serial protocol interface and publishes IMU/NAV data via ROS messages. So far I have most parts working with proper units (accelerometer, barometer, GPS, attitude), but I'm having a hard time figuring out the units of some of the IMU values.

Gyroscope: For the ROS message, I need rad/s. It seems like MultiWii writes the ADC values, so I looked up the details in the MPU-6050 datasheet where it says the range is +/- 2000 deg/s and LSB sensitivity 16.4 deg/s (packed into a 16 bit register), so I should be able to convert to deg/s using the factor gf = 2000. / 32768. I'm not 100% sure this is correct though because the resulting numbers are a bit too small (maybe factor 2), but then it's hard to apply a known angular speed to verify my numbers.

The MultiwiiConfig code divides the number by 8 (instead of 16.384 in my case), does anyone know how the 8 has been computed?

Code: Select all

gx = read16()/8;gy = read16()/8;gz = read16()/8;


The same question for the magnetic field sensor (HMC5883). Although its magnitude is not that important for most applications, I'd like to make sure the units are correct. MultiWiiConf divides by 3, but why?

Code: Select all

magx = read16()/3;magy = read16()/3;magz = read16()/3;


From the MultiWii source and the sensor datasheet I know that it's configured for a range of +/- 1.2 Gauss and with a gain of 1024, so a scaling of 1.2/1024 results in magnitudes of around ~0.5 Ga which seems reasonable.

Thanks,
Robert

balto
Posts: 2
Joined: Sun Oct 27, 2013 6:59 am

Re: Serial protocol: gyroscope and magnetic field units

Post by balto »

Any progress on this? I just joined the forum and this is something I am interested about.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Serial protocol: gyroscope and magnetic field units

Post by timecop »

Multiwii does not use correct units for sensors.
It just takes arbitrary numbers and outputs them.
Don't forget that gyro reads are divided by 4 or 8 to begin with.
The numbers you get back from MSP are just that, numbers.
It depends on what gyro sensor you got, etc.

If you want any kind of hope to have accurate data and insist on sticking with AVR hardware, I suggest using freeimu library or similar, or else if you need stuff that works out of the box and outputs orientation data in variety of formats and can be connected to matlab, etc, I suggest CHRobotics UM6-LT module: https://www.chrobotics.com/shop/orienta ... sor-um6-lt

Post Reply