Skip to content

Commit ec007d4

Browse files
committed
lambda initialization
1 parent d8fe5ea commit ec007d4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

vortex_utils/src/math.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,17 @@ Eigen::Quaterniond average_quaternions(
175175
}
176176

177177
Eigen::Quaterniond enu_ned_rotation(const Eigen::Quaterniond& quat) {
178-
Eigen::Matrix3d R;
179-
R << 0, 1, 0, 1, 0, 0, 0, 0, -1;
178+
const Eigen::Matrix3d rotation_matrix_enu_to_ned = [] {
179+
Eigen::Matrix3d rotmat;
180+
rotmat.col(0) = Eigen::Vector3d(0, 1, 0);
181+
rotmat.col(1) = Eigen::Vector3d(1, 0, 0);
182+
rotmat.col(2) = Eigen::Vector3d(0, 0, -1);
183+
return rotmat;
184+
}();
185+
186+
Eigen::Quaterniond q_out =
187+
Eigen::Quaterniond(rotation_matrix_enu_to_ned) * quat.normalized();
180188

181-
Eigen::Quaterniond q_out = Eigen::Quaterniond(R) * quat.normalized();
182189
return q_out.normalized();
183190
}
184191

0 commit comments

Comments
 (0)