Output unit of magnetic field
ROS MagneticField message defines its output in Tesla. http://docs.ros.org/jade/api/sensor_msgs/html/msg/MagneticField.html 3dm-gx4 measures magnetic filed in Gauss and the driver outputs is thus in Gauss http://www.microstrain.com/inertial/3dm-gx4-25
The conversion between tesla and gauss is 1 Tesla = 10000 Gauss This inconsistency is not very well documented and thus may cause confusion.
We could
- fix the output to Tesla, thus the output will typically range from 0 to 0.00005 Tesla, which is numerically unfavorable.
- keep using gauss, which contradicts with the ros definition, but we could document it in readme. Output will range from 0 to 0.5 Gauss.
Other imu products usually output magnetic field in uT https://www.xsens.com/wp-content/uploads/2015/05/MTi-100-series.pdf http://www.chrobotics.com/docs/UM7_Datasheet.pdf
I would suggest doing number 1. Floating point numbers are stored in scientific notation, so having typical measurements that small will not inherently cause numeric issues.
Numeric conditioning errors come from adding or subtracting numbers of vastly different scales. Ex. (1e10 + 1e-10 - 1e10) = 0 is incorrect, but (1e-10 + 1e-10) = 2e-10 is fine.
Sounds good. I will change it to Tesla then.