framestest.cpp
Go to the documentation of this file.
1 #include "framestest.hpp"
2 #include <frames_io.hpp>
3 #include <utilities/utility.h>
4 
6 
7 using namespace KDL;
8 
10 {
11 }
12 
14 {
15 }
16 
18  Vector v2;
19  CPPUNIT_ASSERT_EQUAL(2*v-v,v);
20  CPPUNIT_ASSERT_EQUAL(v*2-v,v);
21  CPPUNIT_ASSERT_EQUAL(v+v+v-2*v,v);
22  v2=v;
23  CPPUNIT_ASSERT_EQUAL(v,v2);
24  v2+=v;
25  CPPUNIT_ASSERT_EQUAL(2*v,v2);
26  v2-=v;
27  CPPUNIT_ASSERT_EQUAL(v,v2);
28  v2.ReverseSign();
29  CPPUNIT_ASSERT_EQUAL(v,-v2);
30 }
31 
33  Vector v(3,4,5);
34  TestVector2(v);
35  Vector v2(0,0,0);
36  TestVector2(v2);
37 
38  Vector nu(0,0,0);
39  CPPUNIT_ASSERT_EQUAL(nu.Norm(),0.0);
40  Vector nu2(10,0,0);
41  CPPUNIT_ASSERT_EQUAL(nu2.Norm(),10.0);
42 }
43 
45  Vector2 nu(0, 0);
46  CPPUNIT_ASSERT_EQUAL(nu.Norm(), 0.0);
47 
48  CPPUNIT_ASSERT_EQUAL(Vector2(1, 0).Norm(), 1.0);
49  CPPUNIT_ASSERT_EQUAL(Vector2(0, 1).Norm(), 1.0);
50  CPPUNIT_ASSERT_EQUAL(Vector2(-1, 0).Norm(), 1.0);
51  CPPUNIT_ASSERT_EQUAL(Vector2(0, -1).Norm(), 1.0);
52 }
53 
55  Twist t2(Vector(16,-3,5),Vector(-4,2,1));
56 
57  CPPUNIT_ASSERT_EQUAL(2*t-t,t);
58  CPPUNIT_ASSERT_EQUAL(t*2-t,t);
59  CPPUNIT_ASSERT_EQUAL(t+t+t-2*t,t);
60  t2=t;
61  CPPUNIT_ASSERT_EQUAL(t,t2);
62  t2+=t;
63  CPPUNIT_ASSERT_EQUAL(2*t,t2);
64  t2-=t;
65  CPPUNIT_ASSERT_EQUAL(t,t2);
66  t.ReverseSign();
67  CPPUNIT_ASSERT_EQUAL(t,-t2);
68 }
69 
71  Twist t(Vector(6,3,5),Vector(4,-2,7));
72  TestTwist2(t);
73  Twist t2(Vector(0,0,0),Vector(0,0,0));
74  TestTwist2(t2);
75  Twist t3(Vector(0,-9,-3),Vector(1,-2,-4));
76  TestTwist2(t3);
77 }
78 
80  // Wrench
81  Wrench w2;
82  CPPUNIT_ASSERT_EQUAL(2*w-w,w);
83  CPPUNIT_ASSERT_EQUAL(w*2-w,w);
84  CPPUNIT_ASSERT_EQUAL(w+w+w-2*w,w);
85  w2=w;
86  CPPUNIT_ASSERT_EQUAL(w,w2);
87  w2+=w;
88  CPPUNIT_ASSERT_EQUAL(2*w,w2);
89  w2-=w;
90  CPPUNIT_ASSERT_EQUAL(w,w2);
91  w.ReverseSign();
92  CPPUNIT_ASSERT_EQUAL(w,-w2);
93 }
94 
96  Wrench w(Vector(7,-1,3),Vector(2,-3,3));
97  TestWrench2(w);
98  Wrench w2(Vector(0,0,0),Vector(0,0,0));
99  TestWrench2(w2);
100  Wrench w3(Vector(2,1,4),Vector(5,3,1));
101  TestWrench2(w3);
102 }
103 
104 void FramesTest::TestRotation2(const Vector& v,double a,double b,double c) {
105  Vector v2;
106  // Wrench
107  Wrench w(Vector(7,-1,3),Vector(2,-3,3));
108  Twist t(Vector(6,3,5),Vector(4,-2,7));
109  // Rotation
110  Rotation R;
111  Rotation R2;
112  double ra;
113  double rb;
114  double rc;
115  R = Rotation::RPY(a,b,c);
116 
117  CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitX(),R.UnitX()),1.0,epsilon);
118  CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitY(),R.UnitY()),1.0,epsilon);
119  CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitZ(),R.UnitZ()),1.0,epsilon);
120  CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitX(),R.UnitY()),0.0,epsilon);
121  CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitX(),R.UnitZ()),0.0,epsilon);
122  CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitY(),R.UnitZ()),0.0,epsilon);
123  R2=R;
124  CPPUNIT_ASSERT_EQUAL(R,R2);
125  CPPUNIT_ASSERT_DOUBLES_EQUAL((R*v).Norm(),v.Norm(),epsilon);
126  CPPUNIT_ASSERT_EQUAL(R.Inverse(R*v),v);
127  CPPUNIT_ASSERT_EQUAL(R.Inverse(R*t),t);
128  CPPUNIT_ASSERT_EQUAL(R.Inverse(R*w),w);
129  CPPUNIT_ASSERT_EQUAL(R*R.Inverse(v),v);
130  CPPUNIT_ASSERT_EQUAL(R*Rotation::Identity(),R);
131  CPPUNIT_ASSERT_EQUAL(Rotation::Identity()*R,R);
132  CPPUNIT_ASSERT_EQUAL(R*(R*(R*v)),(R*R*R)*v);
133  CPPUNIT_ASSERT_EQUAL(R*(R*(R*t)),(R*R*R)*t);
134  CPPUNIT_ASSERT_EQUAL(R*(R*(R*w)),(R*R*R)*w);
135  CPPUNIT_ASSERT_EQUAL(R*R.Inverse(),Rotation::Identity());
136  CPPUNIT_ASSERT_EQUAL(R.Inverse()*R,Rotation::Identity());
137  CPPUNIT_ASSERT_EQUAL(R.Inverse()*v,R.Inverse(v));
138  R.GetRPY(ra,rb,rc);
139  CPPUNIT_ASSERT_DOUBLES_EQUAL(ra,a,epsilon);
140  CPPUNIT_ASSERT_DOUBLES_EQUAL(rb,b,epsilon);
141  CPPUNIT_ASSERT_DOUBLES_EQUAL(rc,c,epsilon);
142  R = Rotation::EulerZYX(a,b,c);
143  R.GetEulerZYX(ra,rb,rc);
144  CPPUNIT_ASSERT_DOUBLES_EQUAL(ra,a,epsilon);
145  CPPUNIT_ASSERT_DOUBLES_EQUAL(rb,b,epsilon);
146  CPPUNIT_ASSERT_DOUBLES_EQUAL(rc,c,epsilon);
147  R = Rotation::EulerZYZ(a,b,c);
148  R.GetEulerZYZ(ra,rb,rc);
149  CPPUNIT_ASSERT_DOUBLES_EQUAL(ra,a,epsilon);
150  CPPUNIT_ASSERT_DOUBLES_EQUAL(rb,b,epsilon);
151  CPPUNIT_ASSERT_DOUBLES_EQUAL(rc,c,epsilon);
152  double angle= R.GetRotAngle(v2);
153  R2=Rotation::Rot2(v2,angle);
154  CPPUNIT_ASSERT_EQUAL(R2,R);
155  R2=Rotation::Rot(v2*1E20,angle);
156  CPPUNIT_ASSERT_EQUAL(R,R2);
157  v2=Vector(6,2,4);
158  CPPUNIT_ASSERT_DOUBLES_EQUAL((v2).Norm(),::sqrt(dot(v2,v2)),epsilon);
159 }
160 
161 
162 // compare a rotation R with the expected angle and axis
163 void FramesTest::TestOneRotation(const std::string& msg,
164  const KDL::Rotation& R,
165  const double expectedAngle,
166  const KDL::Vector& expectedAxis)
167 {
168  double angle =0;
169  Vector axis;
170 
171  angle = R.GetRotAngle(axis);
172  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(msg, expectedAngle, angle, epsilon);
173  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, expectedAxis, axis);
174  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, expectedAngle * expectedAxis, R.GetRot());
175  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, Rotation::Rot(axis, angle), R);
176  (void)axis.Normalize();
177  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, Rotation::Rot2(axis, angle), R);
178 }
179 
180 
181 
182 void FramesTest::TestArbitraryRotation(const std::string& msg,
183  const KDL::Vector& v,
184  const double angle,
185  const double expectedAngle,
186  const KDL::Vector& expectedVector)
187 {
188  std::stringstream ss;
189  ss << "rot(" << msg << "],(" << angle << ")";
190  TestOneRotation(ss.str(), Rotation::Rot(v,angle*deg2rad), expectedAngle*deg2rad, expectedVector);
191 }
192 
193 
194 #define TESTEULERZYX(a,b,g) \
195  {\
196  double eps=1E-14;\
197  Rotation R = Rotation::EulerZYX((a),(b),(g));\
198  double alpha,beta,gamma;\
199  R.GetEulerZYX(alpha,beta,gamma);\
200  CPPUNIT_ASSERT_DOUBLES_EQUAL((a),alpha,eps);\
201  CPPUNIT_ASSERT_DOUBLES_EQUAL((b),beta,eps);\
202  CPPUNIT_ASSERT_DOUBLES_EQUAL((g),gamma,eps);\
203  }
204 
205 #define TESTEULERZYZ(a,b,g) \
206  {\
207  double eps=1E-14;\
208  Rotation R = Rotation::EulerZYZ((a),(b),(g));\
209  double alpha,beta,gamma;\
210  R.GetEulerZYZ(alpha,beta,gamma);\
211  CPPUNIT_ASSERT_DOUBLES_EQUAL((a),alpha,eps);\
212  CPPUNIT_ASSERT_DOUBLES_EQUAL((b),beta,eps);\
213  CPPUNIT_ASSERT_DOUBLES_EQUAL((g),gamma,eps);\
214  }
215 #define TESTEULERZYX_INVARIANT(a,b,g,a2,b2,g2)\
216  {\
217  double eps=1E-14;\
218  Rotation R1=Rotation::EulerZYX(a,b,g);\
219  Rotation R2=Rotation::EulerZYX(a2,b2,g2);\
220  CPPUNIT_ASSERT_DOUBLES_EQUAL(0,diff(R2,R1).Norm(),eps);\
221  }
222 #define TESTEULERZYZ_INVARIANT(a,b,g,a2,b2,g2)\
223  {\
224  double eps=1E-14;\
225  Rotation R1=Rotation::EulerZYZ(a,b,g);\
226  Rotation R2=Rotation::EulerZYZ(a2,b2,g2);\
227  CPPUNIT_ASSERT_DOUBLES_EQUAL(0,diff(R2,R1).Norm(),eps);\
228  }
230  using namespace KDL;
231  TESTEULERZYX(0.1,0.2,0.3)
232  TESTEULERZYX(-0.1,0.2,0.3)
233  TESTEULERZYX(0.1,-0.2,0.3)
234  TESTEULERZYX(0.1,0.2,-0.3)
235  TESTEULERZYX(0,0.2,0.3)
236  TESTEULERZYX(0.1,0.2,0)
237  TESTEULERZYX(0.1,0,0.3)
238  TESTEULERZYX(0.1,0,0)
239  TESTEULERZYX(0,0,0.3)
240  TESTEULERZYX(0,0,0)
241  TESTEULERZYX(0.3,0.999*PI_2,0.1)
242  // if beta== +/- PI/2 => multiple solutions available, gamma will be chosen to be zero !
243  // so we test with gamma==0 !
244  TESTEULERZYX(0.3,0.9999999999*PI_2,0)
245  TESTEULERZYX(0.3,0.99999999*PI_2,0)
246  TESTEULERZYX(0.3,0.999999*PI_2,0)
247  TESTEULERZYX(0.3,0.9999*PI_2,0)
248  TESTEULERZYX(0.3,0.99*PI_2,0)
249  //TESTEULERZYX(0.1,-PI_2,0.3)
250  TESTEULERZYX(0,PI_2,0)
251 
252  TESTEULERZYX(0.3,-PI_2,0)
253  TESTEULERZYX(0.3,-0.9999999999*PI_2,0)
254  TESTEULERZYX(0.3,-0.99999999*PI_2,0)
255  TESTEULERZYX(0.3,-0.999999*PI_2,0)
256  TESTEULERZYX(0.3,-0.9999*PI_2,0)
257  TESTEULERZYX(0.3,-0.99*PI_2,0)
258  TESTEULERZYX(0,-PI_2,0)
259 
260  // extremes of the range:
261  TESTEULERZYX(PI,-PI_2,0)
262  TESTEULERZYX(-PI,-PI_2,0)
263  TESTEULERZYX(PI,1,0)
264  TESTEULERZYX(-PI,1,0)
265  //TESTEULERZYX(0,-PI_2,PI) gamma will be chosen zero
266  //TESTEULERZYX(0,PI_2,-PI) gamma will be chosen zero
267  TESTEULERZYX(0,1,PI)
268 
269  TESTEULERZYZ(0.1,0.2,0.3)
270  TESTEULERZYZ(-0.1,0.2,0.3)
271  TESTEULERZYZ(0.1,0.9*PI,0.3)
272  TESTEULERZYZ(0.1,0.2,-0.3)
273  TESTEULERZYZ(0,0,0)
274  TESTEULERZYZ(0,0,0)
275  TESTEULERZYZ(0,0,0)
276  TESTEULERZYZ(PI,0,0)
277  TESTEULERZYZ(0,0.2,PI)
278  TESTEULERZYZ(0.4,PI,0)
279  TESTEULERZYZ(0,PI,0)
280  TESTEULERZYZ(PI,PI,0)
281  TESTEULERZYX(0.3,PI_2,0)
282  TESTEULERZYZ(0.3,0.9999999999*PI_2,0)
283  TESTEULERZYZ(0.3,0.99999999*PI_2,0)
284  TESTEULERZYZ(0.3,0.999999*PI_2,0)
285  TESTEULERZYZ(0.3,0.9999*PI_2,0)
286  TESTEULERZYZ(0.3,0.99*PI_2,0)
287 
288  TESTEULERZYX_INVARIANT(0.1,0.2,0.3, 0.1+PI, PI-0.2, 0.3+PI);
289  TESTEULERZYX_INVARIANT(0.1,0.2,0.3, 0.1-PI, PI-0.2, 0.3-PI);
290  TESTEULERZYX_INVARIANT(0.1,0.2,0.3, 0.1-PI, PI-0.2, 0.3+PI);
291  TESTEULERZYX_INVARIANT(0.1,0.2,0.3, 0.1+PI, PI-0.2, 0.3-PI);
292 
293  TESTEULERZYZ_INVARIANT(0.1,0.2,0.3, 0.1+PI, -0.2, 0.3+PI);
294  TESTEULERZYZ_INVARIANT(0.1,0.2,0.3, 0.1-PI, -0.2, 0.3+PI);
295  TESTEULERZYZ_INVARIANT(0.1,0.2,0.3, 0.1+PI, -0.2, 0.3-PI);
296  TESTEULERZYZ_INVARIANT(0.1,0.2,0.3, 0.1-PI, -0.2, 0.3-PI);
297 }
298 
299 void FramesTest::TestRangeArbitraryRotation(const std::string& msg,
300  const KDL::Vector& v,
301  const KDL::Vector& expectedVector)
302 {
303  TestArbitraryRotation(msg, v, 0, 0, Vector(0,0,1)); // no rotation
304  TestArbitraryRotation(msg, v, 45, 45, expectedVector);
305  TestArbitraryRotation(msg, v, 90, 90, expectedVector);
306  TestArbitraryRotation(msg, v, 179, 179, expectedVector);
307 // TestArbitraryRotation(msg, v, 180, 180, expectedVector); // sign VARIES by case because 180 degrees not
308  // full determined: it can return +/- the axis
309  // depending on what the original axis was.
310  // BOTH RESULTS ARE CORRECT.
311  TestArbitraryRotation(msg, v, 181, 179, -expectedVector); // >+180 rotation => <+180 + negative axis
312  TestArbitraryRotation(msg, v, 270, 90, -expectedVector);
313  TestArbitraryRotation(msg, v, 359, 1, -expectedVector);
314  TestArbitraryRotation(msg, v, 360, 0, Vector(0,0,1)); // no rotation
315  TestArbitraryRotation(msg, v, 361, 1, expectedVector);
316  TestArbitraryRotation(msg, v, 450, 90, expectedVector);
317  TestArbitraryRotation(msg, v, 539, 179, expectedVector);
318 // TestArbitraryRotation(msg, v, 540, 180, expectedVector); // see above
319  TestArbitraryRotation(msg, v, 541, 179, -expectedVector); // like 181
320  TestArbitraryRotation(msg, v, 630, 90, -expectedVector); // like 270
321  TestArbitraryRotation(msg, v, 719, 1, -expectedVector); // like 259
322  TestArbitraryRotation(msg, v, 720, 0, Vector(0,0,1)); // no rotation
323 
324  TestArbitraryRotation(msg, v, -45, 45, -expectedVector);
325  TestArbitraryRotation(msg, v, -90, 90, -expectedVector);
326  TestArbitraryRotation(msg, v, -179, 179, -expectedVector);
327 // TestArbitraryRotation(msg, v, -180, 180, expectedVector); // see above
328  TestArbitraryRotation(msg, v, -181, 179, expectedVector);
329  TestArbitraryRotation(msg, v, -270, 90, expectedVector);
330  TestArbitraryRotation(msg, v, -359, 1, expectedVector);
331  TestArbitraryRotation(msg, v, -360, 0, Vector(0,0,1)); // no rotation
332  TestArbitraryRotation(msg, v, -361, 1, -expectedVector);
333  TestArbitraryRotation(msg, v, -450, 90, -expectedVector);
334  TestArbitraryRotation(msg, v, -539, 179, -expectedVector);
335 // TestArbitraryRotation(msg, v, -540, 180, -expectedVector); // see above
336  TestArbitraryRotation(msg, v, -541, 179, expectedVector);
337  TestArbitraryRotation(msg, v, -630, 90, expectedVector);
338  TestArbitraryRotation(msg, v, -719, 1, expectedVector);
339  TestArbitraryRotation(msg, v, -720, 0, Vector(0,0,1)); // no rotation
340 }
341 
343  TestRotation2(Vector(3,4,5),10*deg2rad,20*deg2rad,30*deg2rad);
344 
345  // X axis
346  TestRangeArbitraryRotation("[1,0,0]", Vector(1,0,0), Vector(1,0,0));
347  TestRangeArbitraryRotation("[-1,0,0]", Vector(-1,0,0), Vector(-1,0,0));
348  // Y axis
349  TestRangeArbitraryRotation("[0,1,0]", Vector(0,1,0), Vector(0,1,0));
350  TestRangeArbitraryRotation("[0,-1,0]", Vector(0,-1,0), Vector(0,-1,0));
351  // Z axis
352  TestRangeArbitraryRotation("[0,0,1]", Vector(0,0,1), Vector(0,0,1));
353  TestRangeArbitraryRotation("[0,0,-1]", Vector(0,0,-1), Vector(0,0,-1));
354  // X,Y axes
355  TestRangeArbitraryRotation("[1,1,0]", Vector(1,1,0), Vector(1,1,0)/sqrt(2.0));
356  TestRangeArbitraryRotation("[-1,-1,0]", Vector(-1,-1,0), Vector(-1,-1,0)/sqrt(2.0));
357  // X,Z axes
358  TestRangeArbitraryRotation("[1,0,1]", Vector(1,0,1), Vector(1,0,1)/sqrt(2.0));
359  TestRangeArbitraryRotation("[-1,0,-1]", Vector(-1,0,-1), Vector(-1,0,-1)/sqrt(2.0));
360  // Y,Z axes
361  TestRangeArbitraryRotation("[0,1,1]", Vector(0,1,1), Vector(0,1,1)/sqrt(2.0));
362  TestRangeArbitraryRotation("[0,-1,-1]", Vector(0,-1,-1), Vector(0,-1,-1)/sqrt(2.0));
363  // X,Y,Z axes
364  TestRangeArbitraryRotation("[1,1,1]", Vector(1,1,1), Vector(1,1,1)/sqrt(3.0));
365  TestRangeArbitraryRotation("[-1,-1,-1]", Vector(-1,-1,-1), Vector(-1,-1,-1)/sqrt(3.0));
366 
367  // these change ... some of the -180 are the same as the +180, and some
368  // results are the opposite sign.
369  TestOneRotation("rot([1,0,0],180)", KDL::Rotation::Rot(KDL::Vector(1,0,0),180*deg2rad), 180*deg2rad, Vector(1,0,0));
370  // same as +180
371  TestOneRotation("rot([-1,0,0],180)", KDL::Rotation::Rot(KDL::Vector(-1,0,0),180*deg2rad), 180*deg2rad, Vector(1,0,0));
372  TestOneRotation("rot([0,1,0],180)", KDL::Rotation::Rot(KDL::Vector(0,1,0),180*deg2rad), 180*deg2rad, Vector(0,1,0));
373  // same as +180
374  TestOneRotation("rot([0,-1,0],180)", KDL::Rotation::Rot(KDL::Vector(0,-1,0),180*deg2rad), 180*deg2rad, Vector(0,1,0));
375 
376  TestOneRotation("rot([0,0,1],180)", KDL::Rotation::Rot(KDL::Vector(0,0,1),180*deg2rad), 180*deg2rad, Vector(0,0,1));
377  // same as +180
378  TestOneRotation("rot([0,0,-1],180)", KDL::Rotation::Rot(KDL::Vector(0,0,-1),180*deg2rad), 180*deg2rad, Vector(0,0,1));
379 
380  TestOneRotation("rot([1,0,1],180)", KDL::Rotation::Rot(KDL::Vector(1,0,1),180*deg2rad), 180*deg2rad, Vector(1,0,1)/sqrt(2.0));
381  // same as +180
382  TestOneRotation("rot([1,0,1],-180)", KDL::Rotation::Rot(KDL::Vector(1,0,1),-180*deg2rad), 180*deg2rad, Vector(1,0,1)/sqrt(2.0));
383  TestOneRotation("rot([-1,0,-1],180)", KDL::Rotation::Rot(KDL::Vector(-1,0,-1),180*deg2rad), 180*deg2rad, Vector(1,0,1)/sqrt(2.0));
384  // same as +180
385  TestOneRotation("rot([-1,0,-1],-180)", KDL::Rotation::Rot(KDL::Vector(-1,0,-1),-180*deg2rad), 180*deg2rad, Vector(1,0,1)/sqrt(2.0));
386 
387  TestOneRotation("rot([1,1,0],180)", KDL::Rotation::Rot(KDL::Vector(1,1,0),180*deg2rad), 180*deg2rad, Vector(1,1,0)/sqrt(2.0));
388  // opposite of +180
389  TestOneRotation("rot([1,1,0],-180)", KDL::Rotation::Rot(KDL::Vector(1,1,0),-180*deg2rad), 180*deg2rad, Vector(1,1,0)/sqrt(2.0));
390  TestOneRotation("rot([-1,-1,0],180)", KDL::Rotation::Rot(KDL::Vector(-1,-1,0),180*deg2rad), 180*deg2rad, Vector(1,1,0)/sqrt(2.0));
391  // opposite of +180
392  TestOneRotation("rot([-1,-1,0],-180)", KDL::Rotation::Rot(KDL::Vector(-1,-1,0),-180*deg2rad), 180*deg2rad, Vector(1,1,0)/sqrt(2.0));
393 
394  TestOneRotation("rot([0,1,1],180)", KDL::Rotation::Rot(KDL::Vector(0,1,1),180*deg2rad), 180*deg2rad, Vector(0,1,1)/sqrt(2.0));
395  // same as +180
396  TestOneRotation("rot([0,1,1],-180)", KDL::Rotation::Rot(KDL::Vector(0,1,1),-180*deg2rad), 180*deg2rad, Vector(0,1,1)/sqrt(2.0));
397  TestOneRotation("rot([0,-1,-1],180)", KDL::Rotation::Rot(KDL::Vector(0,-1,-1),180*deg2rad), 180*deg2rad, Vector(0,1,1)/sqrt(2.0));
398  // same as +180
399  TestOneRotation("rot([0,-1,-1],-180)", KDL::Rotation::Rot(KDL::Vector(0,-1,-1),-180*deg2rad), 180*deg2rad, Vector(0,1,1)/sqrt(2.0));
400 
401  TestOneRotation("rot([1,1,1],180)", KDL::Rotation::Rot(KDL::Vector(1,1,1),180*deg2rad), 180*deg2rad, Vector(1,1,1)/sqrt(3.0));
402  // same as +180
403  TestOneRotation("rot([1,1,1],-180)", KDL::Rotation::Rot(KDL::Vector(1,1,1),-180*deg2rad), 180*deg2rad, Vector(1,1,1)/sqrt(3.0));
404  TestOneRotation("rot([-1,-1,-1],180)", KDL::Rotation::Rot(KDL::Vector(-1,-1,-1),180*deg2rad), 180*deg2rad, Vector(1,1,1)/sqrt(3.0));
405  // same as +180
406  TestOneRotation("rot([-1,-1,-1],-180)", KDL::Rotation::Rot(KDL::Vector(-1,-1,-1),-180*deg2rad), 180*deg2rad, Vector(1,1,1)/sqrt(3.0));
407 
408  TestOneRotation("rot([0.707107, 0, 0.707107", KDL::Rotation::RPY(-2.9811968953315162, -atan(1)*2, -0.1603957582582825), 180*deg2rad, Vector(0.707107,0,0.707107) );
409 }
410 
412  double roll = -2.9811968953315162;
413  double pitch = -PI_2;
414  double yaw = -0.1603957582582825;
415 
416  // rpy -> rotation
417  KDL::Rotation kdlRotation1 = KDL::Rotation::RPY(roll, pitch, yaw);
418 
419  // rotation -> angle-axis (with KDL::GetRotAngle)
420  KDL::Vector kdlAxis;
421  double theta = kdlRotation1.GetRotAngle(kdlAxis);
422 
423 
424  CPPUNIT_ASSERT(0==isnan(theta));
425  CPPUNIT_ASSERT(0==isnan(kdlAxis[0]));
426  CPPUNIT_ASSERT(0==isnan(kdlAxis[1]));
427  CPPUNIT_ASSERT(0==isnan(kdlAxis[2]));
428 
429  // Test GetRotAngle on slightly non-orthogonal rotation matrices
430  {
431  Vector axis;
432  double angle = KDL::Rotation( 1, 0, 0 + 1e-6, 0, 1, 0, 0, 0, 1 + 1e-6).GetRotAngle(axis);
433  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rot(NON-ORTHOGONAL, 0)", 0.0, angle, epsilon);
434  }
435 
436  {
437  Vector axis;
438  double angle = KDL::Rotation(-1, 0, 0 + 1e-6, 0, 1, 0, 0, 0, -1 - 1e-6).GetRotAngle(axis);
439  CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("rot(NON-ORTHOGONAL, PI)", PI, angle, epsilon);
440  }
441 
442  // Tests to show that GetRotAngle does not work for an improper rotation matrix which has a determinant of -1;
443  // an improper rotation matrix corresponds to a rotation between a right-hand and left-hand coordinate system
444  {
445  Vector axis;
446  double angle;
447  Rotation R, Rout;
448  double det;
449  // Improper Rotation Matrix for 120 deg rotation
450  R = KDL::Rotation( 0, -1, 0, 0, 0, -1, -1, 0, 0);
451  det = +R(0,0)*(R(1,1)*R(2,2)-R(2,1)*R(1,2))-R(0,1)*(R(1,0)*R(2,2)-R(2,0)*R(1,2))+R(0,2)*(R(1,0)*R(2,1)-R(2,0)*R(1,1));
452  CPPUNIT_ASSERT_EQUAL(det,-1.0);
453  angle = R.GetRotAngle(axis);
454  Rout = KDL::Rotation::Rot(axis, angle);
455  CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT_EQUAL(R,Rout));
456  // Improper Rotation matrix for 180 deg rotation (singular)
457  R = KDL::Rotation( -1, 0, 0, 0, -1, 0, 0, 0, -1);
458  det = +R(0,0)*(R(1,1)*R(2,2)-R(2,1)*R(1,2))-R(0,1)*(R(1,0)*R(2,2)-R(2,0)*R(1,2))+R(0,2)*(R(1,0)*R(2,1)-R(2,0)*R(1,1));
459  CPPUNIT_ASSERT_EQUAL(det,-1.0);
460  angle = R.GetRotAngle(axis);
461  Rout = KDL::Rotation::Rot(axis, angle);
462  CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT_EQUAL(R,Rout));
463  }
464 
465 }
466 
468  Rotation R;
469  Rotation R2;
470  double x,y,z,w;
471  double x2,y2,z2,w2;
472 
473  // identity R -> quat -> R2
474  R.GetQuaternion(x,y,z,w);
475  R2.Quaternion(x,y,z,w);
476  CPPUNIT_ASSERT_EQUAL(R,R2);
477 
478  // 45 deg rotation in X
479  R = Rotation::EulerZYX(0,0,45*deg2rad);
480  R.GetQuaternion(x,y,z,w);
481  CPPUNIT_ASSERT_DOUBLES_EQUAL(x, sin((45*deg2rad)/2), epsilon);
482  CPPUNIT_ASSERT_DOUBLES_EQUAL(y, 0, epsilon);
483  CPPUNIT_ASSERT_DOUBLES_EQUAL(z, 0, epsilon);
484  CPPUNIT_ASSERT_DOUBLES_EQUAL(w, cos((45*deg2rad)/2), epsilon);
485  R2 = Rotation::Quaternion(x,y,z,w);
486  CPPUNIT_ASSERT_EQUAL(R,R2);
487 
488  // direct 45 deg rotation in X
489  R2 = Rotation::Quaternion(sin((45*deg2rad)/2), 0, 0, cos((45*deg2rad)/2));
490  CPPUNIT_ASSERT_EQUAL(R,R2);
491  R2.GetQuaternion(x2,y2,z2,w2);
492  CPPUNIT_ASSERT_DOUBLES_EQUAL(x, x2, epsilon);
493  CPPUNIT_ASSERT_DOUBLES_EQUAL(y, y2, epsilon);
494  CPPUNIT_ASSERT_DOUBLES_EQUAL(z, z2, epsilon);
495  CPPUNIT_ASSERT_DOUBLES_EQUAL(w, w2, epsilon);
496 
497  // 45 deg rotation in X and in Z
498  R = Rotation::EulerZYX(45*deg2rad,0,45*deg2rad);
499  R.GetQuaternion(x,y,z,w);
500  R2 = Rotation::Quaternion(x,y,z,w);
501  CPPUNIT_ASSERT_EQUAL(R,R2);
502  R2.GetQuaternion(x2,y2,z2,w2);
503  CPPUNIT_ASSERT_DOUBLES_EQUAL(x, x2, epsilon);
504  CPPUNIT_ASSERT_DOUBLES_EQUAL(y, y2, epsilon);
505  CPPUNIT_ASSERT_DOUBLES_EQUAL(z, z2, epsilon);
506  CPPUNIT_ASSERT_DOUBLES_EQUAL(w, w2, epsilon);
507 }
508 
510  const std::string& msg,
511  const Rotation& R_a_b1,
512  const Rotation& R_a_b2,
513  const Vector& expectedDiff) {
514  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, diff(R_a_b1, R_a_b2), expectedDiff);
515  CPPUNIT_ASSERT_EQUAL_MESSAGE(msg, addDelta(R_a_b1, expectedDiff), R_a_b2);
516 }
517 
519 
520  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(0*deg2rad))",
521  Rotation::RotX(0*deg2rad), Rotation::RotX(0*deg2rad), Vector(0,0,0)); // no rotation
522  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(90*deg2rad))",
524  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(180*deg2rad))",
526  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(270*deg2rad))",
528  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(360*deg2rad))",
529  Rotation::RotX(0*deg2rad), Rotation::RotX(360*deg2rad), Vector(0,0,0)); // no rotation
530  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(-360*deg2rad))",
531  Rotation::RotX(0*deg2rad), Rotation::RotX(-360*deg2rad), Vector(0,0,0)); // no rotation
532  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(-270*deg2rad))",
534  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(-180*deg2rad))",
536  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(-90*deg2rad))",
538  TestOneRotationDiff("diff(RotX(0*deg2rad),RotX(-0*deg2rad))",
539  Rotation::RotX(0*deg2rad), Rotation::RotX(-0*deg2rad), Vector(0,0,0)); // no rotation
540 
541  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(0*deg2rad))",
542  Rotation::RotY(0*deg2rad), Rotation::RotY(0*deg2rad), Vector(0,0,0)); // no rotation
543  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(90*deg2rad))",
545  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(180*deg2rad))",
547  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(270*deg2rad))",
549  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(360*deg2rad))",
550  Rotation::RotY(0*deg2rad), Rotation::RotY(360*deg2rad), Vector(0,0,0)); // no rotation
551  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(-360*deg2rad))",
552  Rotation::RotY(0*deg2rad), Rotation::RotY(-360*deg2rad), Vector(0,0,0)); // no rotation
553  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(-270*deg2rad))",
555  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(-180*deg2rad))",
557  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(-90*deg2rad))",
559  TestOneRotationDiff("diff(RotY(0*deg2rad),RotY(-0*deg2rad))",
560  Rotation::RotY(0*deg2rad), Rotation::RotY(-0*deg2rad), Vector(0,0,0)); // no rotation
561 
562  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(0*deg2rad))",
563  Rotation::RotZ(0*deg2rad), Rotation::RotZ(0*deg2rad), Vector(0,0,0)); // no rotation
564  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(90*deg2rad))",
566  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(180*deg2rad))",
568  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(270*deg2rad))",
570  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(360*deg2rad))",
571  Rotation::RotZ(0*deg2rad), Rotation::RotZ(360*deg2rad), Vector(0,0,0)); // no rotation
572  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(-360*deg2rad))",
573  Rotation::RotZ(0*deg2rad), Rotation::RotZ(-360*deg2rad), Vector(0,0,0)); // no rotation
574  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(-270*deg2rad))",
576  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(-180*deg2rad))",
578  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(-90*deg2rad))",
580  TestOneRotationDiff("diff(RotZ(0*deg2rad),RotZ(-0*deg2rad))",
581  Rotation::RotZ(0*deg2rad), Rotation::RotZ(-0*deg2rad), Vector(0,0,0)); // no rotation
582 
583  TestOneRotationDiff("diff(RotX(0*deg2rad),RotZ(90*deg2rad))",
585  TestOneRotationDiff("diff(RotX(0*deg2rad),RotY(90*deg2rad))",
587  TestOneRotationDiff("diff(RotY(0*deg2rad),RotZ(90*deg2rad))",
589 
590  TestOneRotationDiff("diff(Identity(),RotX(90*deg2rad))",
592  TestOneRotationDiff("diff(Identity(),RotY(0*deg2rad))",
594  TestOneRotationDiff("diff(Identity(),RotZ(0*deg2rad))",
596 
597  TestOneRotationDiff("diff(Rotation::RPY(+0*deg2rad,0,-90*deg2rad),Rotation::RPY(-0*deg2rad,0,+90*deg2rad))",
598  Rotation::RPY(+0*deg2rad,0,-90*deg2rad),
599  Rotation::RPY(-0*deg2rad,0,+90*deg2rad),
600  Vector(0,0,PI));
601  TestOneRotationDiff("diff(Rotation::RPY(+5*deg2rad,0,-0*deg2rad),Rotation::RPY(-5*deg2rad,0,+0*deg2rad))",
602  Rotation::RPY(+5*deg2rad,0,-0*deg2rad),
603  Rotation::RPY(-5*deg2rad,0,+0*deg2rad),
604  Vector(-10*deg2rad,0,0));
605 
607  TestOneRotationDiff("diff(Rotation::RPY(+5*deg2rad,0,-90*deg2rad),Rotation::RPY(-5*deg2rad,0,+90*deg2rad))",
608  R1, Rotation::RPY(-5*deg2rad,0,+90*deg2rad),
609  R1*Vector(0, 0, 180*deg2rad));
610 }
611 
613  Vector v(3,4,5);
614  Wrench w(Vector(7,-1,3),Vector(2,-3,3)) ;
615  Twist t(Vector(6,3,5),Vector(4,-2,7)) ;
616  Rotation R ;
617  Frame F;
618  Frame F2 ;
619  F = Frame(Rotation::EulerZYX(10*deg2rad,20*deg2rad,-10*deg2rad),Vector(4,-2,1));
620  F2=F ;
621  CPPUNIT_ASSERT_EQUAL(F,F2);
622  CPPUNIT_ASSERT_EQUAL(F.Inverse(F*v),v);
623  CPPUNIT_ASSERT_EQUAL(F.Inverse(F*t),t);
624  CPPUNIT_ASSERT_EQUAL(F.Inverse(F*w),w);
625  CPPUNIT_ASSERT_EQUAL(F*F.Inverse(v),v);
626  CPPUNIT_ASSERT_EQUAL(F*F.Inverse(t),t);
627  CPPUNIT_ASSERT_EQUAL(F*F.Inverse(w),w);
628  CPPUNIT_ASSERT_EQUAL(F*Frame::Identity(),F);
629  CPPUNIT_ASSERT_EQUAL(Frame::Identity()*F,F);
630  CPPUNIT_ASSERT_EQUAL(F*(F*(F*v)),(F*F*F)*v);
631  CPPUNIT_ASSERT_EQUAL(F*(F*(F*t)),(F*F*F)*t);
632  CPPUNIT_ASSERT_EQUAL(F*(F*(F*w)),(F*F*F)*w);
633  CPPUNIT_ASSERT_EQUAL(F*F.Inverse(),Frame::Identity());
634  CPPUNIT_ASSERT_EQUAL(F.Inverse()*F,Frame::Identity());
635  CPPUNIT_ASSERT_EQUAL(F.Inverse()*v,F.Inverse(v));
636 }
637 
639 {
640  JntArray j(size);
641  for (int i = 0; i<size; ++i)
642  random(j(i));
643  return j;
644 }
645 
647 {
648  JntArray random1 = CreateRandomJntArray(4);
649  JntArray random1_copy(random1);
650  CPPUNIT_ASSERT(Equal(random1_copy,random1));
651 
652  JntArray zero_set_to_zero(4);
653  SetToZero(zero_set_to_zero);
654  CPPUNIT_ASSERT(!Equal(random1,zero_set_to_zero));
655 
656  JntArray zero(4);
657  CPPUNIT_ASSERT(Equal(zero_set_to_zero,zero));
658 
659  JntArray almost_zero = CreateRandomJntArray(4);
660  almost_zero(0) = almost_zero(0)*1e-7;
661  almost_zero(1) = almost_zero(1)*1e-7;
662  almost_zero(2) = almost_zero(2)*1e-7;
663  almost_zero(3) = almost_zero(3)*1e-7;
664 
665  // This should obviously be equal, but fails in old buggy implementation
666  CPPUNIT_ASSERT(Equal(almost_zero,zero,1));
667  CPPUNIT_ASSERT(Equal(almost_zero,zero,1e-6));
668  CPPUNIT_ASSERT(!Equal(almost_zero,zero,1e-8));
669 
670  JntArray sum_random_zero(4);
671 
672  Add(random1,zero_set_to_zero,sum_random_zero);
673  CPPUNIT_ASSERT(Equal(random1,sum_random_zero));
674 
675  JntArray add_subtract(4);
676  JntArray random2 = CreateRandomJntArray(4);
677 
678  Add(random1,random2,add_subtract);
679  Subtract(add_subtract,random2,add_subtract);
680  CPPUNIT_ASSERT(Equal(random1,add_subtract));
681 
682  JntArray random_multiply_by_2(4);
683  JntArray sum_random_same_random(4);
684  Multiply(random1,2,random_multiply_by_2);
685  Add(random1,random1,sum_random_same_random);
686  CPPUNIT_ASSERT(Equal(sum_random_same_random,random_multiply_by_2));
687 
688  double a;
689  random(a);
690 
691  JntArray random_multiply_devide(4);
692  Multiply(random1,a,random_multiply_devide);
693  Divide(random_multiply_devide,a,random_multiply_devide);
694  CPPUNIT_ASSERT(Equal(random_multiply_devide,random1));
695 }
696 
697 
699 {
700  JntArray a1;
701  JntArray a2;
702  JntArray a3(a2);
703 
704  // won't assert()
705  CPPUNIT_ASSERT_EQUAL((unsigned int)0,a1.rows());
706  CPPUNIT_ASSERT(Equal(a2,a1));
707 
708  a2 = a1;
709  CPPUNIT_ASSERT(Equal(a2,a1));
710 
711  SetToZero(a2);
712  CPPUNIT_ASSERT(Equal(a2,a1));
713 
714  Add(a1,a2,a3);
715  CPPUNIT_ASSERT(Equal(a1,a3));
716 
717  Subtract(a1,a2,a3);
718  CPPUNIT_ASSERT(Equal(a1,a3));
719 
720  Multiply(a1,3.1,a3);
721  CPPUNIT_ASSERT(Equal(a1,a3));
722 
723  Divide(a1,3.1,a3);
724  CPPUNIT_ASSERT(Equal(a1,a3));
725 
726  // MultiplyJacobian() - not tested here
727 
728 
729  /* will assert() - not tested here
730  double j1 = a1(0);
731  */
732 
733  // and now resize, and do just a few tests
734  a1.resize(3);
735  a2.resize(3);
736  CPPUNIT_ASSERT_EQUAL((unsigned int)3,a1.rows());
737  CPPUNIT_ASSERT(Equal(a2,a1));
738 
739  random(a1(0));
740  random(a1(1));
741  random(a1(2));
742  a1 = a2;
743  CPPUNIT_ASSERT(Equal(a1,a2));
744  CPPUNIT_ASSERT_EQUAL(a1(1),a2(1));
745 
746  a3.resize(3);
747  Subtract(a1,a2,a3); // a3 = a2 - a1 = {0}
748  SetToZero(a1);
749  CPPUNIT_ASSERT(Equal(a1,a3));
750 }
751 
752 
void TestOneRotationDiff(const std::string &msg, const KDL::Rotation &R_a_b1, const KDL::Rotation &R_a_b2, const KDL::Vector &expectedDiff)
Definition: framestest.cpp:509
void Subtract(const JntArray &src1, const JntArray &src2, JntArray &dest)
Definition: jntarray.cpp:87
void TestWrench2(Wrench &w)
Definition: framestest.cpp:79
void TestGetRotAngle()
Definition: framestest.cpp:411
#define TESTEULERZYZ(a, b, g)
Definition: framestest.cpp:205
represents rotations in 3 dimensional space.
Definition: frames.hpp:301
void Divide(const JntArray &src, const double &factor, JntArray &dest)
Definition: jntarray.cpp:97
Vector UnitX() const
Access to the underlying unitvectors of the rotation matrix.
Definition: frames.hpp:510
Vector UnitZ() const
Access to the underlying unitvectors of the rotation matrix.
Definition: frames.hpp:534
double GetRotAngle(Vector &axis, double eps=epsilon) const
Definition: frames.cpp:358
INLINE S Norm(const Rall1d< T, V, S > &value)
Definition: rall1d.h:418
const double PI_2
the value of pi/2
void ReverseSign()
Reverses the sign of the twist.
Definition: frames.hpp:297
void TestFrame()
Definition: framestest.cpp:612
unsigned int rows() const
Definition: jntarray.cpp:72
Vector UnitY() const
Access to the underlying unitvectors of the rotation matrix.
Definition: frames.hpp:522
static Rotation RotX(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
Definition: frames.hpp:606
Rotation Inverse() const
Gives back the inverse rotation matrix of *this.
Definition: frames.hpp:638
#define TESTEULERZYZ_INVARIANT(a, b, g, a2, b2, g2)
Definition: framestest.cpp:222
#define TESTEULERZYX(a, b, g)
Definition: framestest.cpp:194
double Normalize(double eps=epsilon)
Definition: frames.cpp:147
const double PI
the value of pi
void TestQuaternion()
Definition: framestest.cpp:467
static Rotation RotZ(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
Definition: frames.hpp:616
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
Definition: frames.hpp:1130
static Rotation Quaternion(double x, double y, double z, double w)
Definition: frames.cpp:190
2D version of Vector
Definition: frames.hpp:959
This class represents an fixed size array containing joint values of a KDL::Chain.
Definition: jntarray.hpp:69
JntArray CreateRandomJntArray(int size)
Definition: framestest.cpp:638
CPPUNIT_TEST_SUITE_REGISTRATION(FramesTest)
static Rotation RotY(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
Definition: frames.hpp:611
void ReverseSign()
Reverses the sign of the Vector object itself.
Definition: frames.hpp:441
doubleAcc dot(const VectorAcc &lhs, const VectorAcc &rhs)
Definition: frameacc.hpp:138
void ReverseSign()
Reverses the sign of the current Wrench.
Definition: frames.hpp:192
Vector GetRot() const
Definition: frames.cpp:336
void Add(const JntArray &src1, const JntArray &src2, JntArray &dest)
Definition: jntarray.cpp:82
#define TESTEULERZYX_INVARIANT(a, b, g, a2, b2, g2)
Definition: framestest.cpp:215
void GetQuaternion(double &x, double &y, double &z, double &w) const
Definition: frames.cpp:204
double Norm(double eps=epsilon) const
Definition: frames.cpp:117
void TestArbitraryRotation(const std::string &msg, const KDL::Vector &v, const double angle, const double expectedAngle, const KDL::Vector &expectedVector)
Definition: framestest.cpp:182
static Rotation EulerZYX(double Alfa, double Beta, double Gamma)
Definition: frames.hpp:469
void TestRotation()
Definition: framestest.cpp:342
represents both translational and rotational velocities.
Definition: frames.hpp:720
IMETHOD void SetToZero(Vector &v)
Definition: frames.hpp:1069
IMETHOD bool Equal(const FrameAcc &r1, const FrameAcc &r2, double eps=epsilon)
Definition: frameacc.hpp:394
INLINE Rall1d< T, V, S > atan(const Rall1d< T, V, S > &x)
Definition: rall1d.h:377
void TestRotationDiff()
Definition: framestest.cpp:518
A concrete implementation of a 3 dimensional vector class.
Definition: frames.hpp:160
static Rotation RPY(double roll, double pitch, double yaw)
Definition: frames.cpp:237
void TestRangeArbitraryRotation(const std::string &msg, const KDL::Vector &v, const KDL::Vector &expectedVector)
Definition: framestest.cpp:299
double epsilon
default precision while comparing with Equal(..,..) functions. Initialized at 0.0000001.
void TestJntArray()
Definition: framestest.cpp:646
void setUp()
Definition: framestest.cpp:9
static Rotation Identity()
Gives back an identity rotaton matrix.
Definition: frames.hpp:553
void TestEuler()
Definition: framestest.cpp:229
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:369
void TestVector2DNorm()
Definition: framestest.cpp:44
Frame Inverse() const
Gives back inverse transformation of a Frame.
Definition: frames.hpp:423
double Norm(double eps=epsilon) const
Definition: frames.cpp:87
void TestOneRotation(const std::string &msg, const KDL::Rotation &R, const double expectedAngle, const KDL::Vector &expectedAxis)
Definition: framestest.cpp:163
void TestVector()
Definition: framestest.cpp:32
void resize(unsigned int newSize)
Definition: jntarray.cpp:55
void TestJntArrayWhenEmpty()
Definition: framestest.cpp:698
void TestTwist()
Definition: framestest.cpp:70
static Rotation EulerZYZ(double Alfa, double Beta, double Gamma)
Definition: frames.cpp:262
static Frame Identity()
Definition: frames.hpp:701
represents a frame transformation in 3D space (rotation + translation)
Definition: frames.hpp:570
represents both translational and rotational acceleration.
Definition: frames.hpp:878
IMETHOD Vector addDelta(const Vector &p_w_a, const Vector &p_w_da, double dt=1)
adds vector da to vector a. see also the corresponding diff() routine.
Definition: frames.hpp:1157
void TestWrench()
Definition: framestest.cpp:95
void TestVector2(Vector &v)
Definition: framestest.cpp:17
static Rotation Rot(const Vector &rotvec, double angle)
Definition: frames.cpp:293
const double deg2rad
the value pi/180
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:321
static Rotation Rot2(const Vector &rotvec, double angle)
Along an arbitrary axes. rotvec should be normalized.
Definition: frames.cpp:303
void TestRotation2(const Vector &v, double a, double b, double c)
Definition: framestest.cpp:104
IMETHOD void random(Vector &a)
addDelta operator for displacement rotational velocity.
Definition: frames.hpp:1215
void TestTwist2(Twist &t)
Definition: framestest.cpp:54
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:313
void Multiply(const JntArray &src, const double &factor, JntArray &dest)
Definition: jntarray.cpp:92
void tearDown()
Definition: framestest.cpp:13


orocos_kdl
Author(s):
autogenerated on Fri Mar 12 2021 03:05:43