Hello,
I would like to use GTSAM's IMU preintegration in my factor graph and I am currently trying to understand it in depth s.t. I am able to debug in case things don't go as planned.
I think I have a pretty good grasp on most things now except for one:
I don't understand how gravity is not a connected/estimated variable in any of the ImuFactor classes even though it clearly influences the preintegrated measurements (PIM).
For instance in CombinedImuFactor::evaluateError() through a number of indirections we get to PreintegrationBase::predict() and in there we find the code:
// Correct for initial velocity and gravity
Matrix9 D_delta_state, D_delta_biasCorrected;
Vector9 xi = state_i.correctPIM(biasCorrected, deltaTij_, p().n_gravity, p().omegaCoriolis, p().use2ndOrderCoriolis, H1 ? &D_delta_state : nullptr, H2 ? &D_delta_biasCorrected : nullptr);
as we can see p().n_gravity is part of the prediction, however it is just part of the PreintegrationParams (like the IMU noise covariances), so it's a static parameter if I understand correctly.
Is the assumption that, to use IMU Preintegration through GTSAM, a high-accuracy gravity vector must already be given and/or that the coordinate system w.r.t. which my poses / NavStates are defined is already aligned with gravity?
Otherwise, how would this work in a setting where initial orientation of the sensor (and thus gravity direction) is completely unknown?
And even assuming we have an initialization procedure that gives us approx. initial gravity in that case, anything except a perfect initial gravity estimate (or perfect alignment of NavState origin with gravity) would mean our IMU factors could be off badly, no?
Please let me know what I'm missing.
Thanks & Regards.
Rafael