Serial protocol: gyroscope and magnetic field units
Posted: Fri May 17, 2013 4:29 pm
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?
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?
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
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