Skip to content

Commit 683de49

Browse files
committed
Add test coverage for odom message covariances
1 parent 1916276 commit 683de49

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

mecanum_drive_controller/test/mecanum_drive_controller_params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
odom_frame_id: "odom"
1818
enable_odom_tf: true
1919
twist_covariance_diagonal: [0.0, 7.0, 14.0, 21.0, 28.0, 35.0]
20-
pose_covariance_diagonal: [0.0, 7.0, 14.0, 21.0, 28.0, 35.0]
20+
pose_covariance_diagonal: [0.0, 6.0, 12.0, 18.0, 24.0, 30.0]
2121

2222

2323
test_mecanum_drive_controller_with_rotation:

mecanum_drive_controller/test/test_mecanum_drive_controller.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ TEST_F(MecanumDriveControllerTest, when_controller_is_configured_expect_all_para
6262
ASSERT_EQ(controller_->params_.kinematics.base_frame_offset.y, 0.0);
6363
ASSERT_EQ(controller_->params_.kinematics.base_frame_offset.theta, 0.0);
6464

65+
ASSERT_EQ(controller_->params_.pose_covariance_diagonal,
66+
std::vector<double>({0.0, 6.0, 12.0, 18.0, 24.0, 30.0}));
67+
ASSERT_EQ(controller_->params_.twist_covariance_diagonal,
68+
std::vector<double>({0.0, 7.0, 14.0, 21.0, 28.0, 35.0}));
69+
6570
ASSERT_EQ(
6671
controller_->params_.front_left_wheel_command_joint_name, TEST_FRONT_LEFT_CMD_JOINT_NAME);
6772
ASSERT_EQ(
@@ -140,6 +145,25 @@ TEST_F(MecanumDriveControllerTest, configure_succeeds_tf_test_prefix_false_no_na
140145
/* tf_frame_prefix_enable is false so no modifications to the frame id's */
141146
ASSERT_EQ(test_odom_frame_id, odom_id);
142147
ASSERT_EQ(test_base_frame_id, base_link_id);
148+
149+
std::array<double, 36> pose_covariance = {{
150+
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
151+
0.0, 6.0, 0.0, 0.0, 0.0, 0.0,
152+
0.0, 0.0, 12.0, 0.0, 0.0, 0.0,
153+
0.0, 0.0, 0.0, 18.0, 0.0, 0.0,
154+
0.0, 0.0, 0.0, 0.0, 24.0, 0.0,
155+
0.0, 0.0, 0.0, 0.0, 0.0, 30.0}};
156+
157+
std::array<double, 36> twist_covariance = {{
158+
0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
159+
0.0, 7.0, 0.0, 0.0, 0.0, 0.0,
160+
0.0, 0.0, 14.0, 0.0, 0.0, 0.0,
161+
0.0, 0.0, 0.0, 21.0, 0.0, 0.0,
162+
0.0, 0.0, 0.0, 0.0, 28.0, 0.0,
163+
0.0, 0.0, 0.0, 0.0, 0.0, 35.0}};
164+
165+
ASSERT_EQ(odometry_message.pose.covariance, pose_covariance);
166+
ASSERT_EQ(odometry_message.twist.covariance, twist_covariance);
143167
}
144168

145169
TEST_F(MecanumDriveControllerTest, configure_succeeds_tf_test_prefix_true_no_namespace)

0 commit comments

Comments
 (0)