Skip to content

Commit

Permalink
Fix tests due to allow_nonzero..
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Nov 15, 2023
1 parent ad1eac5 commit f45edf7
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,24 @@ class TrajectoryControllerTest : public ::testing::Test
const std::vector<double> initial_acc_joints = INITIAL_ACC_JOINTS,
const std::vector<double> initial_eff_joints = INITIAL_EFF_JOINTS)
{
SetUpTrajectoryController(executor);

// add this to simplify tests, can be overwritten by parameters
rclcpp::Parameter nonzero_vel_parameter("allow_nonzero_velocity_at_trajectory_end", true);
traj_controller_->get_node()->set_parameter(nonzero_vel_parameter);
auto has_nonzero_vel_param =
std::find_if(
parameters.begin(), parameters.end(),
[](const rclcpp::Parameter & param) {
return param.get_name() == "allow_nonzero_velocity_at_trajectory_end";
}) != parameters.end();

std::vector<rclcpp::Parameter> parameters_local = parameters;
if (!has_nonzero_vel_param)
{
// add this to simplify tests, if not set already
parameters_local.emplace_back("allow_nonzero_velocity_at_trajectory_end", true);
}
SetUpTrajectoryController(executor, parameters_local);

// set pid parameters before configure
SetPidParameters(k_p, ff, angle_wraparound);

// set optional parameters
for (const auto & param : parameters)
{
traj_controller_->get_node()->set_parameter(param);
}

traj_controller_->get_node()->configure();

ActivateTrajectoryController(
Expand Down

0 comments on commit f45edf7

Please sign in to comment.