Skip to content

Commit

Permalink
Make sure that we can send new robot description over topic is the fi…
Browse files Browse the repository at this point in the history
…rst one fails.
  • Loading branch information
destogl committed Feb 1, 2024
1 parent 26585af commit 62e4384
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions controller_manager/test/test_controller_manager_urdf_passing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TestableControllerManager : public controller_manager::ControllerManager
TestControllerManagerWithTestableCM, load_and_initialize_components_called_after_callback);
FRIEND_TEST(
TestControllerManagerWithTestableCM,
load_and_initialize_components_called_after_invalid_urdf_passed);
expect_to_failure_when_invalid_urdf_is_given_and_be_able_to_submit_new_robot_description);

public:
TestableControllerManager(
Expand Down Expand Up @@ -78,12 +78,17 @@ TEST_P(TestControllerManagerWithTestableCM, load_and_initialize_components_calle

TEST_P(
TestControllerManagerWithTestableCM,
load_and_initialize_components_called_after_invalid_urdf_passed)
expect_to_failure_when_invalid_urdf_is_given_and_be_able_to_submit_new_robot_description)
{
ASSERT_FALSE(cm_->resource_manager_->are_components_initialized());
// mimic callback
// wrong urdf
auto msg = std_msgs::msg::String();
msg.data = ros2_control_test_assets::minimal_robot_missing_command_keys_urdf;
msg.data = ros2_control_test_assets::minimal_unitilizable_robot_urdf;
cm_->robot_description_callback(msg);
ASSERT_FALSE(cm_->resource_manager_->are_components_initialized());
// correct urdf
msg = std_msgs::msg::String();
msg.data = ros2_control_test_assets::minimal_robot_urdf;
cm_->robot_description_callback(msg);
ASSERT_TRUE(cm_->resource_manager_->are_components_initialized());
}
Expand Down
2 changes: 1 addition & 1 deletion hardware_interface/src/resource_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ bool ResourceManager::validate_storage(

RCUTILS_LOG_ERROR_NAMED(
"resource_manager",
"Discrepancy between robot description file (urdf) and actually exported HW interfaces."
"Discrepancy between robot description file (urdf) and actually exported HW interfaces.\n"
"Details: %s",
message.c_str());

Expand Down

0 comments on commit 62e4384

Please sign in to comment.