1 #define BOOST_TEST_MODULE ArmarX::RobotTrajectoryDesigner::SplineInterpolationSegment
2 #define ARMARX_BOOST_TEST
4 #include <RobotComponents/Test.h>
6 #include "../../Interpolation/LinearInterpolation.h"
7 #include "../../Util/OrientationConversion.h"
8 #include "../../Interpolation/SplineInterpolation.h"
17 Vector3BasePtr pos1 =
new Vector3(2, 4, 6);
19 PoseBasePtr pose1 =
new Pose(pos1, ori1);
21 Vector3BasePtr pos2 =
new Vector3(0, 1, 2);
23 PoseBasePtr pose2 =
new Pose(pos2, ori2);
26 Vector3BasePtr pos3 =
new Vector3(0, -5, -2);
28 PoseBasePtr pose3 =
new Pose(pos3, ori3);
30 std::vector<PoseBasePtr> cp = {pose1, pose2, pose3};
36 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->x, 2);
37 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->y, 4);
38 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->z, 6);
39 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->x, 0);
40 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->y, 1);
41 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->z, 2);
42 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->x, 0);
43 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->y, 1);
44 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->z, 2);
45 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->x, 0);
46 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->y, -5);
47 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->z, -2);
52 Vector3BasePtr pos1 =
new Vector3(2, 4, 6);
54 PoseBasePtr pose1 =
new Pose(pos1, ori1);
56 Vector3BasePtr pos2 =
new Vector3(2, 4, 6);
58 PoseBasePtr pose2 =
new Pose(pos2, ori2);
60 Vector3BasePtr pos3 =
new Vector3(2, 4, 6);
62 PoseBasePtr pose3 =
new Pose(pos3, ori3);
64 Vector3BasePtr pos4 =
new Vector3(2, 4, 6);
66 PoseBasePtr pose4 =
new Pose(pos4, ori4);
68 std::vector<PoseBasePtr> cp = {pose1, pose2, pose3, pose4};
79 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->orientation->qw, q1->qw);
80 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->orientation->qx, q1->qx);
81 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->orientation->qy, q1->qy);
82 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->orientation->qz, q1->qz);
84 BOOST_CHECK_CLOSE(ips1->getPoseAt(1)->orientation->qw, q2->qw, 1);
85 BOOST_CHECK_CLOSE(ips1->getPoseAt(1)->orientation->qx, q2->qx, 1);
86 BOOST_CHECK_CLOSE(ips1->getPoseAt(1)->orientation->qy, q2->qy, 1);
87 BOOST_CHECK_CLOSE(ips1->getPoseAt(1)->orientation->qz, q2->qz, 1);
89 BOOST_CHECK_CLOSE(ips2->getPoseAt(0)->orientation->qw, q2->qw, 1);
90 BOOST_CHECK_CLOSE(ips2->getPoseAt(0)->orientation->qx, q2->qx, 1);
91 BOOST_CHECK_CLOSE(ips2->getPoseAt(0)->orientation->qy, q2->qy, 1);
92 BOOST_CHECK_CLOSE(ips2->getPoseAt(0)->orientation->qz, q2->qz, 1);
94 BOOST_CHECK_CLOSE(ips2->getPoseAt(1)->orientation->qw, q3->qw, 1);
95 BOOST_CHECK_CLOSE(ips2->getPoseAt(1)->orientation->qx, q3->qx, 1);
96 BOOST_CHECK_CLOSE(ips2->getPoseAt(1)->orientation->qy, q3->qy, 1);
97 BOOST_CHECK_CLOSE(ips2->getPoseAt(1)->orientation->qz, q3->qz, 1);
100 BOOST_CHECK_CLOSE(ips3->getPoseAt(0)->orientation->qw, q3->qw, 1);
101 BOOST_CHECK_CLOSE(ips3->getPoseAt(0)->orientation->qx, q3->qx, 1);
102 BOOST_CHECK_CLOSE(ips3->getPoseAt(0)->orientation->qy, q3->qy, 1);
103 BOOST_CHECK_CLOSE(ips3->getPoseAt(0)->orientation->qz, q3->qz, 1);
105 BOOST_CHECK_EQUAL(ips3->getPoseAt(1)->orientation->qw, q4->qw);
106 BOOST_CHECK_EQUAL(ips3->getPoseAt(1)->orientation->qx, q4->qx);
107 BOOST_CHECK_EQUAL(ips3->getPoseAt(1)->orientation->qy, q4->qy);
108 BOOST_CHECK_EQUAL(ips3->getPoseAt(1)->orientation->qz, q4->qz);
116 Vector3BasePtr pos1 =
new Vector3(2, 4, 6);
118 PoseBasePtr pose1 =
new Pose(pos1, ori1);
120 Vector3BasePtr pos2 =
new Vector3(0, -2, -8);
122 PoseBasePtr pose2 =
new Pose(pos2, ori2);
124 Vector3BasePtr pos3 =
new Vector3(2, 4, 6);
126 PoseBasePtr pose3 =
new Pose(pos3, ori3);
128 std::vector<PoseBasePtr> cp = {pose1, pose2, pose3};
134 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->x, 2);
135 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->y, 4);
136 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->z, 6);
137 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->x, 0);
138 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->y, -2);
139 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->z, -8);
140 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->x, 0);
141 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->y, -2);
142 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->z, -8);
143 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->x, 2);
144 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->y, 4);
145 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->z, 6);
153 Vector3BasePtr pos1 =
new Vector3(2, 4, 6);
155 PoseBasePtr pose1 =
new Pose(pos1, ori1);
157 Vector3BasePtr pos2 =
new Vector3(0, -2, -8);
159 PoseBasePtr pose2 =
new Pose(pos2, ori2);
161 Vector3BasePtr pos3 =
new Vector3(5, 8, 7);
163 PoseBasePtr pose3 =
new Pose(pos3, ori3);
165 Vector3BasePtr pos4 =
new Vector3(4, 23, 1);
167 PoseBasePtr pose4 =
new Pose(pos4, ori4);
169 Vector3BasePtr pos5 =
new Vector3(7, 12, 4);
171 PoseBasePtr pose5 =
new Pose(pos5, ori5);
173 Vector3BasePtr pos6 =
new Vector3(7, 44, -3);
175 PoseBasePtr pose6 =
new Pose(pos6, ori6);
177 Vector3BasePtr pos7 =
new Vector3(5, 4, -8);
179 PoseBasePtr pose7 =
new Pose(pos7, ori7);
181 Vector3BasePtr pos8 =
new Vector3(5, -4, -8);
183 PoseBasePtr pose8 =
new Pose(pos8, ori8);
185 Vector3BasePtr pos9 =
new Vector3(0, 0, 4);
187 PoseBasePtr pose9 =
new Pose(pos9, ori9);
189 Vector3BasePtr pos10 =
new Vector3(0, 1, 2);
191 PoseBasePtr pose10 =
new Pose(pos10, ori10);
193 Vector3BasePtr pos11 =
new Vector3(0, 0, 0);
195 PoseBasePtr pose11 =
new Pose(pos11, ori11);
197 std::vector<PoseBasePtr> cp = {pose1, pose2, pose3, pose4, pose5, pose6, pose7, pose8, pose9, pose10, pose11};
210 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->x, 2);
211 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->y, 4);
212 BOOST_CHECK_EQUAL(ips1->getPoseAt(0)->position->z, 6);
213 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->x, 0);
214 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->y, -2);
215 BOOST_CHECK_EQUAL(ips1->getPoseAt(1)->position->z, -8);
217 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->x, 0);
218 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->y, -2);
219 BOOST_CHECK_EQUAL(ips2->getPoseAt(0)->position->z, -8);
220 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->x, 5);
221 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->y, 8);
222 BOOST_CHECK_EQUAL(ips2->getPoseAt(1)->position->z, 7);
224 BOOST_CHECK_EQUAL(ips3->getPoseAt(0)->position->x, 5);
225 BOOST_CHECK_EQUAL(ips3->getPoseAt(0)->position->y, 8);
226 BOOST_CHECK_EQUAL(ips3->getPoseAt(0)->position->z, 7);
227 BOOST_CHECK_EQUAL(ips3->getPoseAt(1)->position->x, 4);
228 BOOST_CHECK_EQUAL(ips3->getPoseAt(1)->position->y, 23);
229 BOOST_CHECK_EQUAL(ips3->getPoseAt(1)->position->z, 1);
231 BOOST_CHECK_EQUAL(ips4->getPoseAt(0)->position->x, 4);
232 BOOST_CHECK_EQUAL(ips4->getPoseAt(0)->position->y, 23);
233 BOOST_CHECK_EQUAL(ips4->getPoseAt(0)->position->z, 1);
234 BOOST_CHECK_EQUAL(ips4->getPoseAt(1)->position->x, 7);
235 BOOST_CHECK_EQUAL(ips4->getPoseAt(1)->position->y, 12);
236 BOOST_CHECK_EQUAL(ips4->getPoseAt(1)->position->z, 4);
238 BOOST_CHECK_EQUAL(ips5->getPoseAt(0)->position->x, 7);
239 BOOST_CHECK_EQUAL(ips5->getPoseAt(0)->position->y, 12);
240 BOOST_CHECK_EQUAL(ips5->getPoseAt(0)->position->z, 4);
241 BOOST_CHECK_EQUAL(ips5->getPoseAt(1)->position->x, 7);
242 BOOST_CHECK_EQUAL(ips5->getPoseAt(1)->position->y, 44);
243 BOOST_CHECK_EQUAL(ips5->getPoseAt(1)->position->z, -3);
245 BOOST_CHECK_EQUAL(ips6->getPoseAt(0)->position->x, 7);
246 BOOST_CHECK_EQUAL(ips6->getPoseAt(0)->position->y, 44);
247 BOOST_CHECK_EQUAL(ips6->getPoseAt(0)->position->z, -3);
248 BOOST_CHECK_EQUAL(ips6->getPoseAt(1)->position->x, 5);
249 BOOST_CHECK_EQUAL(ips6->getPoseAt(1)->position->y, 4);
250 BOOST_CHECK_EQUAL(ips6->getPoseAt(1)->position->z, -8);
252 BOOST_CHECK_EQUAL(ips7->getPoseAt(0)->position->x, 5);
253 BOOST_CHECK_EQUAL(ips7->getPoseAt(0)->position->y, 4);
254 BOOST_CHECK_EQUAL(ips7->getPoseAt(0)->position->z, -8);
255 BOOST_CHECK_EQUAL(ips7->getPoseAt(1)->position->x, 5);
256 BOOST_CHECK_EQUAL(ips7->getPoseAt(1)->position->y, -4);
257 BOOST_CHECK_EQUAL(ips7->getPoseAt(1)->position->z, -8);
259 BOOST_CHECK_EQUAL(ips8->getPoseAt(0)->position->x, 5);
260 BOOST_CHECK_EQUAL(ips8->getPoseAt(0)->position->y, -4);
261 BOOST_CHECK_EQUAL(ips8->getPoseAt(0)->position->z, -8);
262 BOOST_CHECK_EQUAL(ips8->getPoseAt(1)->position->x, 0);
264 BOOST_CHECK_EQUAL(ips8->getPoseAt(1)->position->z, 4);
266 BOOST_CHECK_EQUAL(ips9->getPoseAt(0)->position->x, 0);
268 BOOST_CHECK_EQUAL(ips9->getPoseAt(0)->position->z, 4);
270 BOOST_CHECK_EQUAL(ips9->getPoseAt(1)->position->y, 1);
271 BOOST_CHECK_EQUAL(ips9->getPoseAt(1)->position->z, 2);
274 BOOST_CHECK_EQUAL(ips10->getPoseAt(0)->position->y, 1);
275 BOOST_CHECK_EQUAL(ips10->getPoseAt(0)->position->z, 2);
276 BOOST_CHECK_EQUAL(ips10->getPoseAt(1)->position->x, 0);
277 BOOST_CHECK_EQUAL(ips10->getPoseAt(1)->position->y, 0);
278 BOOST_CHECK_EQUAL(ips10->getPoseAt(1)->position->z, 0);