Skip to content
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

[JointTrajectoryController] Add test for param propagation from overrides (e.g. yaml files) #226

Closed
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
35 changes: 35 additions & 0 deletions joint_trajectory_controller/test/test_trajectory_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,3 +1187,38 @@ TEST_F(TrajectoryControllerTest, incorrect_initialization_using_interface_parame
state_interface_types_ = {"acceleration"};
set_parameter_and_check_result();
}

TEST_P(TrajectoryControllerTestParameterized, test_param_propagation)
{

SetUpTrajectoryController(false);

auto parameters_client = std::make_shared<rclcpp::AsyncParametersClient>(traj_controller_->get_node());
while (!parameters_client->wait_for_service(1s)) {
if (!rclcpp::ok()) {
rclcpp::shutdown();
}
}

auto set_parameter_and_check_result = [&](rclcpp::Parameter& p) {

// This call is replacing the way parameters are set via launch
parameters_client->set_parameters({p});
EXPECT_EQ(traj_controller_->get_node()->has_parameter(p.get_name()), true);
};

rclcpp::Parameter j1_goal_constraint("constraints.joint1.goal", 0.01);
set_parameter_and_check_result(j1_goal_constraint);

rclcpp::Parameter j2_trajectory_constraint("constraints.joint1.trajectory", 0.01);
set_parameter_and_check_result(j2_trajectory_constraint);

rclcpp::Parameter joint_names_param("joints", joint_names_);
set_parameter_and_check_result(joint_names_param);

rclcpp::Parameter cmd_interfaces_params("command_interfaces", command_interface_types_);
set_parameter_and_check_result(cmd_interfaces_params);

rclcpp::Parameter state_interfaces_params("state_interfaces", state_interface_types_);
set_parameter_and_check_result(state_interfaces_params);
}