rpng / open_vins

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

Wrong timestamp in state propagation #461

Open pritzvac opened 3 months ago

pritzvac commented 3 months ago

Hi, I think I found a bug in the propagation of IMU measurements. The problematic code: https://github.com/rpng/open_vins/blob/17b73cfe4b870ade0a65f9eb217d8aab58deae19/ov_msckf/src/state/Propagator.cpp#L154 As far as I understand it, time1 is the stamp into which the state should be propagated, timestamp is the latest IMU stamp (the method is essentially called in the ROS IMU callback) and cache_t_off is the calibrated IMU-camera time offset. But if the time offset is defined as t_imu = t_cam + cache_t_off, i.e., the delay of camera messages, then it shouldn't be added to the IMU timestamps. It causes that the state is propagated much further into future than the latest available IMU measurement, which requires linear extrapolation using https://github.com/rpng/open_vins/blob/17b73cfe4b870ade0a65f9eb217d8aab58deae19/ov_msckf/src/state/Propagator.h#L154 In my case the state is extrapolated into the future by about 0.04 s each time, producing quite jerky behavior, which is mostly visible in the twist values. Sometimes it even causes large outliers because the IMU that I'm using sometimes produces data with incorrect timestamps. See the image - the red data is the original output, the blue data is output when i changed the code to be just double time1 = timestamp;. Selection_295