Skip to content

Commit

Permalink
Add more parameter overriding tests by parsing multiple parameter fil…
Browse files Browse the repository at this point in the history
…es (#1899)
  • Loading branch information
saikishor committed Dec 3, 2024
1 parent d41c2a0 commit 825ebfa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controller_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ if(BUILD_TESTING)
install(FILES test/test_controller_spawner_with_type.yaml
DESTINATION test)

install(FILES test/test_controller_overriding_parameters.yaml
DESTINATION test)

ament_add_gmock(
test_hardware_management_srvs
test/test_hardware_management_srvs.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ctrl_with_parameters_and_type:
ros__parameters:
interface_name: "impedance"
joint_offset: 0.2
joint_names: ["joint10"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ctrl_with_parameters_and_type:
ros__parameters:
type: "controller_manager/test_controller"
joint_names: ["joint0"]
interface_name: "position"

/**:
chainable_ctrl_with_parameters_and_type:
Expand Down
6 changes: 6 additions & 0 deletions controller_manager/test/test_spawner_unspawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ TEST_F(TestLoadController, spawner_test_with_params_file_string_parameter)
ASSERT_THAT(
ctrl_node->get_parameter("joint_names").as_string_array(),
std::vector<std::string>({"joint0"}));

if (!ctrl_node->has_parameter("interface_name"))
{
ctrl_node->declare_parameter("interface_name", "invalid_interface");
}
ASSERT_EQ(ctrl_node->get_parameter("interface_name").as_string(), "position");
}

TEST_F(TestLoadController, spawner_test_type_in_arg)
Expand Down

0 comments on commit 825ebfa

Please sign in to comment.