locusrobotics / robot_navigation

Spiritual successor to ros-planning/navigation.
450 stars 148 forks source link

Fix #71 - backward driving acc limit #84

Closed Thazz closed 2 years ago

DLu commented 2 years ago

@Thazz I put together this test. Does this match what you expect out of the method?

TEST(VelocityIterator, acceleration_magnitude)
{
  double accel_rate = 2.0;
  double decel_rate = -3.0;
  EXPECT_NEAR(projectVelocity(+1.0, accel_rate, decel_rate, 0.1, +1.5), +1.2, EPSILON);
  EXPECT_NEAR(projectVelocity(+1.0, accel_rate, decel_rate, 0.1, +0.5), +0.7, EPSILON);
  EXPECT_NEAR(projectVelocity(-1.0, accel_rate, decel_rate, 0.1, -1.5), -1.2, EPSILON);
  EXPECT_NEAR(projectVelocity(-1.0, accel_rate, decel_rate, 0.1, -0.5), -0.7, EPSILON);
}
Thazz commented 2 years ago

Yes, this is it.