Skip to content

Commit 050c50d

Browse files
committed
Take T_cn_cnm1 instead of cam1/T_cam_imu from the calibration file
1 parent 365c45c commit 050c50d

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

config/camchain-imucam-euroc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ cam1:
1919
-0.999755099723116, 0.013011905181504, 0.017900583825251, -0.020569771258915,
2020
0.018223771455443, 0.025158836311552, 0.999517347077547, -0.008638135126028,
2121
0, 0, 0, 1.000000000000000]
22+
T_cn_cnm1:
23+
[0.999997256477881, 0.002312067192424, 0.000376008102415, -0.110073808127187,
24+
-0.002317135723281, 0.999898048506644, 0.014089835846648, 0.000399121547014,
25+
-0.000343393120525, -0.014090668452714, 0.999900662637729, -0.000853702503357,
26+
0, 0, 0, 1.000000000000000]
2227
camera_model: pinhole
2328
distortion_coeffs: [-0.28368365, 0.07451284, -0.00010473, -3.55590700e-05]
2429
distortion_model: radtan

src/image_processor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ bool ImageProcessor::loadParameters() {
9393
R_cam0_imu = R_imu_cam0.t();
9494
t_cam0_imu = -R_imu_cam0.t() * t_imu_cam0;
9595

96-
cv::Mat T_imu_cam1 = utils::getTransformCV(nh, "cam1/T_cam_imu");
96+
cv::Mat T_cam0_cam1 = utils::getTransformCV(nh, "cam1/T_cn_cnm1");
97+
cv::Mat T_imu_cam1 = T_cam0_cam1 * T_imu_cam0;
9798
cv::Matx33d R_imu_cam1(T_imu_cam1(cv::Rect(0,0,3,3)));
9899
cv::Vec3d t_imu_cam1 = T_imu_cam1(cv::Rect(3,0,1,3));
99100
R_cam1_imu = R_imu_cam1.t();

src/msckf_vio.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,12 @@ bool MsckfVio::loadParameters() {
132132
Isometry3d T_imu_cam0 = utils::getTransformEigen(nh, "cam0/T_cam_imu");
133133
Isometry3d T_cam0_imu = T_imu_cam0.inverse();
134134

135-
Isometry3d T_imu_cam1 = utils::getTransformEigen(nh, "cam1/T_cam_imu");
136-
Isometry3d T_cam1_imu = T_imu_cam1.inverse();
137-
138-
Isometry3d T_body_imu = utils::getTransformEigen(nh, "T_imu_body");
139-
140-
//CAMState::T_imu_cam0 = T_cam0_imu.inverse();
141135
state_server.imu_state.R_imu_cam0 = T_cam0_imu.linear().transpose();
142136
state_server.imu_state.t_cam0_imu = T_cam0_imu.translation();
143-
CAMState::T_cam0_cam1 = T_imu_cam1 * T_cam0_imu;
144-
IMUState::T_imu_body = T_body_imu.inverse();
137+
CAMState::T_cam0_cam1 =
138+
utils::getTransformEigen(nh, "cam1/T_cn_cnm1");
139+
IMUState::T_imu_body =
140+
utils::getTransformEigen(nh, "T_imu_body").inverse();
145141

146142
// Maximum number of camera states to be stored
147143
nh.param<int>("max_cam_state_size", max_cam_state_size, 30);
@@ -172,8 +168,8 @@ bool MsckfVio::loadParameters() {
172168
ROS_INFO("initial extrinsic translation cov: %f",
173169
extrinsic_translation_cov);
174170

175-
cout << T_imu_cam1.linear() << endl;
176-
cout << T_imu_cam1.translation().transpose() << endl;
171+
cout << T_imu_cam0.linear() << endl;
172+
cout << T_imu_cam0.translation().transpose() << endl;
177173

178174
ROS_INFO("max camera state #: %d", max_cam_state_size);
179175
ROS_INFO("===========================================");

0 commit comments

Comments
 (0)