cartographer-project / cartographer

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
Apache License 2.0
7.12k stars 2.25k forks source link

question about imu tracker's gravity vector #1651

Open weidezhang opened 4 years ago

weidezhang commented 4 years ago

Hi, I'm still confused about how gravity vector was updated in IMU tracker's AddIMULinearAccelerationObservation function.

gravityvector = (1. - alpha) gravityvector + alpha imu_linear_acceleration;

As far as I understand, gravity_vector represents the gravitational direction in tracking frame. confused about why imu_linear_acceleration can add with gravity_vector ? what does the result mean ?

ojura commented 4 years ago

This is a simple first-order exponential smoothing filter which slowly pulls the value of gravity_vector_ towards the value of imu_linear_acceleration. It is usually used when your measurements are noisy (like imu_linear_acceleration are), but you want to follow the moving average of those measurements.

See https://en.wikipedia.org/wiki/Exponential_smoothing

weidezhang commented 4 years ago

thanks. i guess it also assumes the imu_linearacceleration is mostly due to gravity instead of motion ? // Change the orientation so that it agrees with the current // gravityvector. const Eigen::Quaterniond rotation = Eigen::Quaterniond::FromTwoVectors( gravityvector, orientation.conjugate() * Eigen::Vector3d::UnitZ()); orientation = (orientation_ * rotation).normalized();

@ojura do you know why we need to adjust the orientation to the gravity vector ? isn't those the same thing or different ?

garlinplus commented 4 years ago

ments are noisy (like imu_linear_ac void ImuTracker::Advance(const common::Time time) { CHECKLE(time, time); const double deltat = common::ToSeconds(time - time); const Eigen::Quaterniond rotation = transform::AngleAxisVectorToRotationQuaternion( Eigen::Vector3d(imu_angularvelocity deltat)); orientation = (orientation_ rotation).normalized(); *gravityvector = rotation.conjugate() gravityvector;** time_ = time; }

Every imu measure step,the gravity vector is converted its frame,is it right? If there is a filter for imu acc data,it should be filtered in robot imu frame or in earth frame.But the frame in this is always transformed between robot imu body frame and earth frame.

kyo055 commented 3 years ago

ments are noisy (like imu_linear_ac void ImuTracker::Advance(const common::Time time) { CHECKLE(time, time); const double deltat = common::ToSeconds(time - time); const Eigen::Quaterniond rotation = transform::AngleAxisVectorToRotationQuaternion( Eigen::Vector3d(imu_angularvelocity deltat)); orientation = (orientation_ rotation).normalized(); *gravityvector = rotation.conjugate() gravityvector;** time_ = time; }

Every imu measure step,the gravity vector is converted its frame,is it right? If there is a filter for imu acc data,it should be filtered in robot imu frame or in earth frame.But the frame in this is always transformed between robot imu body frame and earth frame.

I just want to konw why alhpa equals exp(-delta_t/im_gravity_timeconstant) ???