Skip to content
Snippets Groups Projects
Commit 890b8500 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Fix Array contruction

parent 6fbc0e4c
No related branches found
No related tags found
3 merge requests!31devel->main,!29Add functionality for UAV,!27Fix test with acc_x = 2 m/s2
...@@ -116,10 +116,14 @@ void ProcessorForceTorqueInertialPreintDynamics::emplaceFeaturesAndFactors(Captu ...@@ -116,10 +116,14 @@ void ProcessorForceTorqueInertialPreintDynamics::emplaceFeaturesAndFactors(Captu
FactorBase::emplace<FactorForceTorqueInertialDynamics>( FactorBase::emplace<FactorForceTorqueInertialDynamics>(
ftr_fti, ftr_fti, _capture_origin, shared_from_this(), params_->apply_loss_function); ftr_fti, ftr_fti, _capture_origin, shared_from_this(), params_->apply_loss_function);
// 2. Feature and factor L -- angular moment // 2. Feature and factor L -- angular momentum
//------------------------------------------- //---------------------------------------------
// - feature has the current gyro measurement // - feature has the current gyro measurement
// - factor relates w_measured, IMU_bias(last capture), L(last capture) and i(sensor) // - factor relates w_measured, IMU_bias(last capture), L(last capture) and i(sensor)
// auto measurement_gyro = motion.data_.segment<3>(3);
// auto meas_cov = sensor_fti_->getNoiseCov().block<3,3>(3,3); // ??
// 3. Feature and factor bias -- IMU bias drift for acc and gyro // 3. Feature and factor bias -- IMU bias drift for acc and gyro
//--------------------------------------------------------------- //---------------------------------------------------------------
...@@ -173,12 +177,10 @@ void ProcessorForceTorqueInertialPreintDynamics::configure(SensorBasePtr _sensor ...@@ -173,12 +177,10 @@ void ProcessorForceTorqueInertialPreintDynamics::configure(SensorBasePtr _sensor
auto acc_drift_std = sensor_fti_->getParamsSensorForceTorqueInertial()->acc_drift_std; auto acc_drift_std = sensor_fti_->getParamsSensorForceTorqueInertial()->acc_drift_std;
auto gyro_drift_std = sensor_fti_->getParamsSensorForceTorqueInertial()->gyro_drift_std; auto gyro_drift_std = sensor_fti_->getParamsSensorForceTorqueInertial()->gyro_drift_std;
gyro_noise_cov_ = Eigen::Array3d(gyro_noise_std, gyro_noise_std, gyro_noise_std).square().matrix().asDiagonal(); ArrayXd imu_drift_sigmas(6);
imu_drift_cov_ = imu_drift_sigmas << acc_drift_std, acc_drift_std, acc_drift_std, gyro_drift_std, gyro_drift_std, gyro_drift_std;
Eigen::Array<double,6,1>(acc_drift_std, acc_drift_std, acc_drift_std, gyro_drift_std, gyro_drift_std, gyro_drift_std) imu_drift_cov_ = imu_drift_sigmas.square().matrix().asDiagonal();
.square() gyro_noise_cov_ = Array3d(gyro_noise_std, gyro_noise_std, gyro_noise_std).square().matrix().asDiagonal();
.matrix()
.asDiagonal();
} }
void ProcessorForceTorqueInertialPreintDynamics::data2tangent(const Eigen::VectorXd& _data, void ProcessorForceTorqueInertialPreintDynamics::data2tangent(const Eigen::VectorXd& _data,
......
...@@ -101,6 +101,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri ...@@ -101,6 +101,7 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
S->getStateBlock('C')->fix(); S->getStateBlock('C')->fix();
S->getStateBlock('i')->fix(); S->getStateBlock('i')->fix();
S->getStateBlock('m')->unfix(); S->getStateBlock('m')->unfix();
// S->setStateBlockDynamic('I');
CaptureMotionPtr C0_0 = std::make_shared<CaptureMotion>("CaptureMotion", 0.0, S, data, data_cov, nullptr); CaptureMotionPtr C0_0 = std::make_shared<CaptureMotion>("CaptureMotion", 0.0, S, data, data_cov, nullptr);
CaptureMotionPtr C1_0 = std::make_shared<CaptureMotion>("CaptureMotion", 0.2, S, data, data_cov, nullptr); CaptureMotionPtr C1_0 = std::make_shared<CaptureMotion>("CaptureMotion", 0.2, S, data, data_cov, nullptr);
...@@ -145,6 +146,9 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri ...@@ -145,6 +146,9 @@ TEST_F(Test_SolveProblemForceTorqueInertialPreintDynamics_yaml, mass_only_hoveri
WOLF_INFO("-----------------------------"); WOLF_INFO("-----------------------------");
} }
P->print(4, 1, 1, 1);
ASSERT_NEAR(S->getStateBlock('m')->getState()(0), mass_true, 1e-3); ASSERT_NEAR(S->getStateBlock('m')->getState()(0), mass_true, 1e-3);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment