Skip to content

Add tests for multiple controller ros args #2155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions controller_manager/test/test_spawner_unspawner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,9 @@ TEST_F(TestLoadController, test_spawner_parsed_controller_ros_args)

// Now test the remapping of the service name with the controller_ros_args
EXPECT_EQ(
call_spawner(
"ctrl_2 -c test_controller_manager --controller-ros-args '-r /ctrl_2/set_bool:=/set_bool'"),
call_spawner("ctrl_2 -c test_controller_manager --controller-ros-args '-r "
"/ctrl_2/set_bool:=/set_bool' --controller-ros-args '--param "
"run_cycle:=20 -p test_cycle:=-11.0'"),
0);

ASSERT_EQ(cm_->get_loaded_controllers().size(), 2ul);
Expand All @@ -825,6 +826,20 @@ TEST_F(TestLoadController, test_spawner_parsed_controller_ros_args)
node->create_client<example_interfaces::srv::SetBool>("/ctrl_2/set_bool");
ASSERT_FALSE(ctrl_2_set_bool_service->wait_for_service(std::chrono::seconds(2)));
ASSERT_FALSE(ctrl_2_set_bool_service->service_is_ready());

// Check the parameter run_cycle to have the right value
ASSERT_EQ("ctrl_2", cm_->get_loaded_controllers()[0].info.name);
auto ctrl_2 = cm_->get_loaded_controllers()[0].c->get_node();
if (!ctrl_2->has_parameter("run_cycle"))
{
ctrl_2->declare_parameter("run_cycle", -200);
}
ASSERT_THAT(ctrl_2->get_parameter("run_cycle").as_int(), 20);
if (!ctrl_2->has_parameter("test_cycle"))
{
ctrl_2->declare_parameter("test_cycle", 1231.0);
}
ASSERT_THAT(ctrl_2->get_parameter("test_cycle").as_double(), -11.0);
}

class TestLoadControllerWithoutRobotDescription
Expand Down
Loading