Skip to content

Commit

Permalink
Rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
christophfroehlich committed Dec 20, 2023
1 parent 08142dc commit 2dce0af
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions joint_trajectory_controller/test/test_trajectory_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,24 +1247,22 @@ TEST_P(TrajectoryControllerTestParameterized, invalid_message_nonzero_vel)
rclcpp::executors::SingleThreadedExecutor executor;
SetUpAndActivateTrajectoryController(executor, {nonzero_vel_parameters});

trajectory_msgs::msg::JointTrajectory traj_msg, good_traj_msg;

good_traj_msg.joint_names = joint_names_;
good_traj_msg.header.stamp = rclcpp::Time(0);
good_traj_msg.points.resize(1);
good_traj_msg.points[0].time_from_start = rclcpp::Duration::from_seconds(0.25);
good_traj_msg.points[0].positions.resize(1);
good_traj_msg.points[0].positions = {1.0, 2.0, 3.0};
good_traj_msg.points[0].velocities.resize(1);
good_traj_msg.points[0].velocities = {-1.0, -2.0, -3.0};
// Nonzero velocity at trajectory end!
EXPECT_FALSE(traj_controller_->validate_trajectory_msg(good_traj_msg));
trajectory_msgs::msg::JointTrajectory traj_msg;
traj_msg.joint_names = joint_names_;
traj_msg.header.stamp = rclcpp::Time(0);

// empty message (no throw!)
traj_msg = good_traj_msg;
traj_msg.points.clear();
ASSERT_NO_THROW(traj_controller_->validate_trajectory_msg(traj_msg));
EXPECT_FALSE(traj_controller_->validate_trajectory_msg(traj_msg));

// Nonzero velocity at trajectory end!
traj_msg.points.resize(1);
traj_msg.points[0].time_from_start = rclcpp::Duration::from_seconds(0.25);
traj_msg.points[0].positions.resize(1);
traj_msg.points[0].positions = {1.0, 2.0, 3.0};
traj_msg.points[0].velocities.resize(1);
traj_msg.points[0].velocities = {-1.0, -2.0, -3.0};
EXPECT_FALSE(traj_controller_->validate_trajectory_msg(traj_msg));
}

/**
Expand Down

0 comments on commit 2dce0af

Please sign in to comment.