1 #include <gtest/gtest.h> 5 TEST(TEBBasic, autoResizeLargeValueAtEnd)
8 double dt_hysteresis = dt/3.;
12 for (
int i = 1; i < 10; ++i) {
19 teb.
autoResize(dt, dt_hysteresis, 3, 100,
false);
21 ASSERT_LE(teb.
TimeDiff(i), dt + dt_hysteresis + 1e-3) <<
"dt is greater than allowed: " << i;
22 ASSERT_LE(dt - dt_hysteresis - 1e-3, teb.
TimeDiff(i)) <<
"dt is less than allowed: " << i;
26 TEST(TEBBasic, autoResizeSmallValueAtEnd)
29 double dt_hysteresis = dt/3.;
33 for (
int i = 1; i < 10; ++i) {
40 teb.
autoResize(dt, dt_hysteresis, 3, 100,
false);
42 ASSERT_LE(teb.
TimeDiff(i), dt + dt_hysteresis + 1e-3) <<
"dt is greater than allowed: " << i;
43 ASSERT_LE(dt - dt_hysteresis - 1e-3, teb.
TimeDiff(i)) <<
"dt is less than allowed: " << i;
50 double dt_hysteresis = dt/3.;
54 for (
int i = 1; i < 10; ++i) {
58 teb.
TimeDiff(5) = dt + 2*dt_hysteresis;
62 teb.
autoResize(dt, dt_hysteresis, 3, 100,
false);
64 ASSERT_LE(teb.
TimeDiff(i), dt + dt_hysteresis + 1e-3) <<
"dt is greater than allowed: " << i;
65 ASSERT_LE(dt - dt_hysteresis - 1e-3, teb.
TimeDiff(i)) <<
"dt is less than allowed: " << i;
69 int main(
int argc,
char** argv)
71 testing::InitGoogleTest(&argc, argv);
72 return RUN_ALL_TESTS();
Class that defines a trajectory modeled as an elastic band with augmented tempoarl information...
void addPoseAndTimeDiff(const PoseSE2 &pose, double dt)
Append a (pose, timediff) vertex pair to the end of the current trajectory (pose and timediff sequenc...
void addPose(const PoseSE2 &pose, bool fixed=false)
Append a new pose vertex to the back of the pose sequence.
int sizeTimeDiffs() const
Get the length of the internal timediff sequence.
double & TimeDiff(int index)
Access the time difference at pos index of the time sequence.
int main(int argc, char **argv)
TEST(TEBBasic, autoResizeLargeValueAtEnd)
This class implements a pose in the domain SE2: The pose consist of the position x and y and an orie...
void autoResize(double dt_ref, double dt_hysteresis, int min_samples=3, int max_samples=1000, bool fast_mode=false)
Resize the trajectory by removing or inserting a (pose,dt) pair depending on a reference temporal res...