31 #include <gtest/gtest.h> 34 TEST(TrajectoryTests, test_unwind)
51 std::vector<bool> continuous(3,
false);
58 EXPECT_EQ(3.0, t.
points[0].q[0]);
59 EXPECT_EQ(3.2831853071795862, t.
points[1].q[0]);
60 EXPECT_EQ(3.0, t.
points[2].q[0]);
62 EXPECT_EQ(-3.0, t.
points[0].q[1]);
63 EXPECT_EQ(-3.2831853071795862, t.
points[1].q[1]);
64 EXPECT_EQ(-3.0, t.
points[2].q[1]);
66 EXPECT_EQ(-3.0, t.
points[0].q[2]);
67 EXPECT_EQ(3.0, t.
points[1].q[2]);
68 EXPECT_EQ(-3.0, t.
points[2].q[2]);
72 EXPECT_EQ(3.0, t.
points[0].q[0]);
73 EXPECT_EQ(-3.0, t.
points[0].q[1]);
74 EXPECT_EQ(-3.0, t.
points[0].q[2]);
76 EXPECT_EQ(-3.0, t.
points[1].q[0]);
77 EXPECT_EQ(3.0, t.
points[1].q[1]);
78 EXPECT_EQ(3.0, t.
points[1].q[2]);
80 EXPECT_EQ(3.0, t.
points[2].q[0]);
81 EXPECT_EQ(-3.0, t.
points[2].q[1]);
82 EXPECT_EQ(-3.0, t.
points[2].q[2]);
94 TEST(TrajectoryTests, test_multiple_unwinds)
98 t.
points[0].q.push_back(-3.0);
99 t.
points[1].q.push_back(3.0);
100 t.
points[2].q.push_back(1.0);
101 t.
points[3].q.push_back(-1.0);
102 t.
points[4].q.push_back(-3.0);
103 t.
points[5].q.push_back(3.0);
104 t.
points[6].q.push_back(1.0);
105 t.
points[7].q.push_back(-1.0);
106 t.
points[8].q.push_back(-3.0);
107 t.
points[9].q.push_back(3.0);
109 std::vector<bool> continuous(1,
true);
114 EXPECT_EQ(-3.0, t.
points[0].q[0]);
115 EXPECT_EQ(-3.2831853071795862, t.
points[1].q[0]);
116 EXPECT_EQ(-5.2831853071795862, t.
points[2].q[0]);
117 EXPECT_EQ(-7.2831853071795862, t.
points[3].q[0]);
118 EXPECT_EQ(-9.2831853071795862, t.
points[4].q[0]);
119 EXPECT_EQ(-9.566370614359172, t.
points[5].q[0]);
120 EXPECT_EQ(-11.566370614359172, t.
points[6].q[0]);
121 EXPECT_EQ(-13.566370614359172, t.
points[7].q[0]);
122 EXPECT_EQ(-15.566370614359172, t.
points[8].q[0]);
123 EXPECT_EQ(-15.849555921538759, t.
points[9].q[0]);
127 int main(
int argc,
char **argv)
129 testing::InitGoogleTest(&argc, argv);
130 return RUN_ALL_TESTS();
std::vector< TrajectoryPoint > points
bool windupTrajectory(std::vector< bool > continuous, Trajectory &trajectory)
Windup the trajectory so that continuous joints do not wrap.
TEST(TrajectoryTests, test_unwind)
bool unwindTrajectoryPoint(std::vector< bool > continuous, TrajectoryPoint &p)
int main(int argc, char **argv)