diff --git a/joint_limits/test/test_joint_saturation_limiter.cpp b/joint_limits/test/test_joint_saturation_limiter.cpp index f778e81507c..e9705a66622 100644 --- a/joint_limits/test/test_joint_saturation_limiter.cpp +++ b/joint_limits/test/test_joint_saturation_limiter.cpp @@ -88,14 +88,10 @@ TEST_F(JointSaturationLimiterTest, when_no_posstate_expect_enforce_false) // test no position interface current_joint_states_.positions.clear(); ASSERT_FALSE(joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period)); - - // also fail if out of limits - desired_joint_states_.positions[0] = 20.0; - ASSERT_FALSE(joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period)); } } -TEST_F(JointSaturationLimiterTest, when_no_velstate_expect_limiting) +TEST_F(SimpleJointLimiterTest, when_no_velstate_expect_enforce_succeed) { SetupNode("joint_saturation_limiter"); Load(); @@ -108,9 +104,6 @@ TEST_F(JointSaturationLimiterTest, when_no_velstate_expect_limiting) rclcpp::Duration period(1, 0); // 1 second // test no vel interface current_joint_states_.velocities.clear(); - ASSERT_FALSE(joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period)); - // also fail if out of limits - desired_joint_states_.positions[0] = 20.0; ASSERT_TRUE(joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period)); } } @@ -131,7 +124,7 @@ TEST_F(JointSaturationLimiterTest, when_within_limits_expect_no_limits_applied) // within limits desired_joint_states_.positions[0] = 1.0; desired_joint_states_.velocities[0] = 1.0; // valid pos derivatite as well - ASSERT_FALSE(joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period)); + ASSERT_TRUE(joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period)); // check if no limits applied CHECK_STATE_SINGLE_JOINT( @@ -320,14 +313,10 @@ TEST_F(JointSaturationLimiterTest, when_position_close_to_pos_limit_expect_decel desired_joint_states_.velocities[0] = 1.5; // this setup requires 0.15 distance to stop, and 0.2 seconds (so 4 cycles at 0.05) - std::vector expected_ret = {true, true, true, false}; for (auto i = 0u; i < 4; ++i) { auto previous_vel_request = desired_joint_states_.velocities[0]; - // expect limits applied until the end stop - ASSERT_EQ( - joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period), - expected_ret[i]); + ASSERT_TRUE(joint_limiter_->enforce(current_joint_states_, desired_joint_states_, period)); ASSERT_LE( desired_joint_states_.velocities[0],