rpng / open_vins

An open source platform for visual-inertial navigation research.
https://docs.openvins.com
GNU General Public License v3.0
2.19k stars 647 forks source link

Sign of gravity vector #174

Closed stefangachter closed 3 years ago

stefangachter commented 3 years ago

I have a more subtle issue with the gravity vector sign definition in the IMU propagation derivations https://docs.openvins.com/propagation.html The equation for the accelerometer states image that is specific force as measured by the IMU is equal to acceleration of the IMU plus gravity plus bias plus noise. According to Newton's second law of motion, the sum of all specific forces is equal to the acceleration. In my understanding, gravity is a mass specific force. Thus, the equation should be image or rearranged image Thus, the sign of gravity vector should be negative.

goldbattle commented 3 years ago

You can define it any way you want as long as you are consistent.

stefangachter commented 3 years ago

Sure, you can define it as long as you are consistent. Personally, I find it confusing this way. An IMU cannot measure gravity, only the reaction force due to gravity. Assume a bias- and noise-free IMU at rest with its z-axis pointing upwards, then acceleration is zero and the equation results image The IMU readings are about 9.81m/s^2 and positive, because it is measuring the reaction force not gravity. The gravity vector is expected to point downwards to earth center. This is not reflected in this equation.

goldbattle commented 3 years ago

The frame {I} is the local IMU frame, not the global frame. You can define gravity going up or down, and you will just have a flipped local frame. For example the ENU vs the NED frames in GPS inertial systems. Here we present it in a "measurement model" way, thus we have the raw reading, being equal to some values (true, gravity, bias, and noise).

You might also check out some comments in the gtsam project: https://github.com/borglab/gtsam/blob/329e70e33d7d79546952e91c7d965ab244be4185/gtsam/navigation/CombinedImuFactor.h#L80-L88 https://github.com/borglab/gtsam/blob/2c5be4de19362ada218bb476700a96ba75bf1d77/gtsam/navigation/GPSFactor.h#L26-L34

Z-down navigation frame, such as NED: gravity points along positive Z-axis
Z-up navigation frame, such as ENU: gravity points along negative Z-axis
stefangachter commented 3 years ago

Thanks for the information.

It is one thing what the IMU is measuring - only specific forces - and another thing how to choose the global frame. The global frame can be chosen independent of the IMU. If ENU or NED does not matter. Probably we agree on that. I understand that you are using a "measurement model". My point is that IMU can measure gravity only as a reaction force.

Any major text book of inertial navigation - for example Jekeli, Inertial Navigation Systems with Geodetic Applications, Titterton and Weston, Strapdown Inertial Navigation Technology, or Groves, Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems - have a lengthy section on these laws and conventions. And these text books end up with a negative sign for the gravity.

Using a "measurement model" is fine, but can get confusing when taking a look at the actual IMU readings. That is my experience, but maybe it is my limited understanding.

stefangachter commented 3 years ago

I had a lengthy discussion with a mathematician on the topic above, which changed my view. As pointed out above by @goldbattle, you can define "gravity" vector the "way you want". The gravity vector is then not necessarily the "gravitational force" as a Physicist would define it. Advantage of OpenVINS definition is that accelerometer at rest measures the gravity vector. - Thus, one just has to know assumptions and definitions made. There is no "requirement" for a certain direction.