Skip to content

Commit

Permalink
Revert "Update tests after changes."
Browse files Browse the repository at this point in the history
This reverts commit 4f868b1.
  • Loading branch information
destogl committed Dec 18, 2023
1 parent 51ce7a2 commit 09002b5
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions joint_limits/test/test_joint_saturation_limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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));
}
}
Expand All @@ -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(
Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 09002b5

Please sign in to comment.