Skip to content

delta bias calculation in evaluate in IMU Error #4

@chengfzy

Description

@chengfzy

Hi, In SimpleBA.cpp line 81-115, which is used to calculate the IMU error using preintegration, and in line 87-88, the delta_b_g = b_gj - b_gi. But in the paper of "On-Manifold Preintegration for Real-Time Visual--Inertial Odometry", which said, above Eq. (44) b_g =b_g_bar + delta_b_g.

Does the code make sense?

bool IMUErr::Evaluate(double const *const *parameters,
                      double *residuals,
                      double **jacobians) const {
	Eigen::Map<const Eigen::Matrix<double, 15, 1>> posei(parameters[0]);
	Eigen::Map<const Eigen::Matrix<double, 15, 1>> posej(parameters[1]);

	Eigen::Vector3d dbias_g = posej.block<3, 1>(9, 0) - posei.block<3, 1>(9, 0);
	Eigen::Vector3d dbias_a = posej.block<3, 1>(12, 0) - posei.block<3, 1>(12, 0);

	auto imuParam = viframe_i->getImuParam();

	const Eigen::Vector3d &vi = posei.block<3, 1>(6, 0);
	const Eigen::Vector3d &vj = posej.block<3, 1>(6, 0);
	const Eigen::Vector3d &pi = posei.block<3, 1>(3, 0);
	const Eigen::Vector3d &pj = posej.block<3, 1>(3, 0);

	double dt = (viframe_j->getTimeStamp() - viframe_i->getTimeStamp()).toSec();

	Sophus::SO3d Ri = Sophus::SO3d::exp(posei.block<3, 1>(0, 0));
	Sophus::SO3d Rj = Sophus::SO3d::exp(posej.block<3, 1>(0, 0));
	imuFactor::FacJBias_t JBias = imufactor->getJBias();
	const Sophus::SE3d& T_ij = imufactor->getPoseFac();

	Eigen::Matrix<double, 9, 1> Err;
	Err.block<3, 1>(0, 0) = Sophus::SO3d::log((T_ij.so3() * Sophus::SO3d::exp(JBias.block<3, 3>(0, 0)
	                                           * dbias_g)).inverse() * (Ri.inverse() * Rj));

	Err.block<3, 1>(6, 0) = Ri.inverse() * (vj - vi - imuParam->g * dt)
	                         - (imufactor->getSpeedFac() + JBias.block<3, 3>(6, 0) * dbias_g
	                                                   + JBias.block<3, 3>(3, 0) * dbias_a);

	Err.block<3, 1>(3, 0) = Ri.inverse() * (pj - pi - vi * dt - 0.5 * imuParam->g * dt * dt)
	                        - (imufactor->getPoseFac().translation() + JBias.block<3, 3>(12, 0) * dbias_g
	                                                  +  JBias.block<3, 3>(9, 0) * dbias_a);
	Eigen::Matrix<double, 9, 1> err = L * Err;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions