KDL 1.5.1
Loading...
Searching...
No Matches
frames.hpp
Go to the documentation of this file.
1/***************************************************************************
2 frames.hpp `- description
3 -------------------------
4 begin : June 2006
5 copyright : (C) 2006 Erwin Aertbelien
6 email : firstname.lastname@mech.kuleuven.be
7
8 History (only major changes)( AUTHOR-Description ) :
9
10 ***************************************************************************
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2.1 of the License, or (at your option) any later version. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19 * Lesser General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU Lesser General Public *
22 * License along with this library; if not, write to the Free Software *
23 * Foundation, Inc., 59 Temple Place, *
24 * Suite 330, Boston, MA 02111-1307 USA *
25 * *
26 ***************************************************************************/
27
37 * A naming convention of objects of the type defined in this file :
38 * (1) Frame : F...
39 * Rotation : R ...
40 * (2) Twist : T ...
41 * Wrench : W ...
42 * Vector : V ...
43 * This prefix is followed by :
44 * for category (1) :
45 * F_A_B : w.r.t. frame A, frame B expressed
46 * ( each column of F_A_B corresponds to an axis of B,
47 * expressed w.r.t. frame A )
48 * in mathematical convention :
49 * A
50 * F_A_B == F
51 * B
52 *
53 * for category (2) :
54 * V_B : a vector expressed w.r.t. frame B
55 *
56 * This can also be prepended by a name :
57 * e.g. : temporaryV_B
58 *
59 * With this convention one can write :
60 *
61 * F_A_B = F_B_A.Inverse();
62 * F_A_C = F_A_B * F_B_C;
63 * V_B = F_B_C * V_C; // both translation and rotation
64 * V_B = R_B_C * V_C; // only rotation
65 * \endverbatim
66 *
67 * \par CONVENTIONS FOR WHEN USED WITH ROBOTS :
68 *
69 * \verbatim
70 * world : represents the frame ([1 0 0,0 1 0,0 0 1],[0 0 0]')
71 * mp : represents mounting plate of a robot
72 * (i.e. everything before MP is constructed by robot manufacturer
73 * everything after MP is tool )
74 * tf : represents task frame of a robot
75 * (i.e. frame in which motion and force control is expressed)
76 * sf : represents sensor frame of a robot
77 * (i.e. frame at which the forces measured by the force sensor
78 * are expressed )
79 *
80 * Frame F_world_mp=...;
81 * Frame F_mp_sf(..)
82 * Frame F_mp_tf(,.)
83 *
84 * Wrench are measured in sensor frame SF, so one could write :
85 * Wrench_tf = F_mp_tf.Inverse()* ( F_mp_sf * Wrench_sf );
86 * \endverbatim
87 *
88 * \par CONVENTIONS REGARDING UNITS :
89 * Any consistent series of units can be used, e.g. N,mm,Nmm,..mm/sec
90 *
91 * \par Twist and Wrench transformations
92 * 3 different types of transformations do exist for the twists
93 * and wrenches.
94 *
95 * \verbatim
96 * 1) Frame * Twist or Frame * Wrench :
97 * this transforms both the velocity/force reference point
98 * and the basis to which the twist/wrench are expressed.
99 * 2) Rotation * Twist or Rotation * Wrench :
100 * this transforms the basis to which the twist/wrench are
101 * expressed, but leaves the reference point intact.
102 * 3) Twist.RefPoint(v_base_AB) or Wrench.RefPoint(v_base_AB)
103 * this transforms only the reference point. v is expressed
104 * in the same base as the twist/wrench and points from the
105 * old reference point to the new reference point.
106 * \endverbatim
107 *
108 *\par Spatial cross products
109 * Let m be a 6D motion vector (Twist) and f be a 6D force vector (Wrench)
110 * attached to a rigid body moving with a certain velocity v (Twist). Then
111 *\verbatim
112 * 1) m_dot = v cross m or Twist=Twist*Twist
113 * 2) f_dot = v cross f or Wrench=Twist*Wrench
114 *\endverbatim
115 *
116 * \par Complexity
117 * Sometimes the amount of work is given in the documentation
118 * e.g. 6M+3A means 6 multiplications and 3 additions.
119 *
120 * \author
121 * Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven
122 *
123 ****************************************************************************/
124#ifndef KDL_FRAMES_H
125#define KDL_FRAMES_H
126
127
128#include "utilities/kdl-config.h"
129#include "utilities/utility.h"
132
133namespace KDL {
134
135
136
137class Vector;
138class Rotation;
139class Frame;
140class Wrench;
141class Twist;
142class Vector2;
143class Rotation2;
144class Frame2;
145
146
147// Equal is friend function, but default arguments for friends are forbidden (ยง8.3.6.4)
148inline bool Equal(const Vector& a,const Vector& b,double eps=epsilon);
149inline bool Equal(const Frame& a,const Frame& b,double eps=epsilon);
150inline bool Equal(const Twist& a,const Twist& b,double eps=epsilon);
151inline bool Equal(const Wrench& a,const Wrench& b,double eps=epsilon);
152inline bool Equal(const Vector2& a,const Vector2& b,double eps=epsilon);
153inline bool Equal(const Rotation2& a,const Rotation2& b,double eps=epsilon);
154inline bool Equal(const Frame2& a,const Frame2& b,double eps=epsilon);
155
156
157/**
158 * \brief A concrete implementation of a 3 dimensional vector class
159 */
161{
162public:
163 double data[3];
165 inline Vector() {data[0]=data[1]=data[2] = 0.0;}
168 inline Vector(double x,double y, double z);
169
171 inline Vector(const Vector& arg);
172
173
174 inline Vector& operator = ( const Vector& arg);
175
176 //! Access to elements, range checked when NDEBUG is not set, from 0..2
177 inline double operator()(int index) const;
178
180 inline double& operator() (int index);
183 double operator[] ( int index ) const
184 {
185 return this->operator() ( index );
187
189 double& operator[] ( int index )
190 {
191 return this->operator() ( index );
193
194 inline double x() const;
195 inline double y() const;
196 inline double z() const;
197 inline void x(double);
198 inline void y(double);
199 inline void z(double);
200
202 inline void ReverseSign();
203
204
206 inline Vector& operator-=(const Vector& arg);
207
208
210 inline Vector& operator +=(const Vector& arg);
211
213 inline friend Vector operator*(const Vector& lhs,double rhs);
215 inline friend Vector operator*(double lhs,const Vector& rhs);
216
218 inline friend Vector operator/(const Vector& lhs,double rhs);
219 inline friend Vector operator+(const Vector& lhs,const Vector& rhs);
220 inline friend Vector operator-(const Vector& lhs,const Vector& rhs);
221 inline friend Vector operator*(const Vector& lhs,const Vector& rhs);
222 inline friend Vector operator-(const Vector& arg);
223 inline friend double dot(const Vector& lhs,const Vector& rhs);
227 inline friend void SetToZero(Vector& v);
228
230 inline static Vector Zero();
231
232
233 * makes v a unitvector and returns the norm of v.
234 * if v is smaller than eps, Vector(1,0,0) is returned with norm 0.
235 * if this is not good, check the return value of this method.
236 */
237 double Normalize(double eps=epsilon);
238
240 double Norm(double eps=epsilon) const;
241
242
245 inline void Set2DXY(const Vector2& v);
247 inline void Set2DYZ(const Vector2& v);
248 //! a 3D vector where the 2D vector v is put in the ZX plane
249 inline void Set2DZX(const Vector2& v);
251 inline void Set2DPlane(const Frame& F_someframe_XY,const Vector2& v_XY);
252
256 inline friend bool Equal(const Vector& a,const Vector& b,double eps);
257
259 inline friend bool operator==(const Vector& a,const Vector& b);
261 inline friend bool operator!=(const Vector& a,const Vector& b);
262
263 friend class Rotation;
264 friend class Frame;
265};
266
267
271 This class represents a rotation matrix with the following
272 conventions :
273 \verbatim
274 Suppose V2 = R*V, (1)
275 V is expressed in frame B
276 V2 is expressed in frame A
277 This matrix R consists of 3 columns [ X,Y,Z ],
278 X,Y, and Z contain the axes of frame B, expressed in frame A
279 Because of linearity expr(1) is valid.
280 \endverbatim
281 This class only represents rotational_interpolation, not translation
282 Two interpretations are possible for rotation angles.
283 * if you rotate with angle around X frame A to have frame B,
284 then the result of SetRotX is equal to frame B expressed wrt A.
285 In code:
286 \verbatim
287 Rotation R;
288 F_A_B = R.SetRotX(angle);
289 \endverbatim
290 * Secondly, if you take the following code :
291 \verbatim
292 Vector p,p2; Rotation R;
293 R.SetRotX(angle);
294 p2 = R*p;
295 \endverbatim
296 then the frame p2 is rotated around X axis with (-angle).
297 Analogue reasonings can be applyd to SetRotY,SetRotZ,SetRot
298 \par type
299 Concrete implementation
300*/
302{
303public:
304 double data[9];
305
306 inline Rotation() {
307 *this = Rotation::Identity();
308 }
309 inline Rotation(double Xx,double Yx,double Zx,
310 double Xy,double Yy,double Zy,
311 double Xz,double Yz,double Zz);
312 inline Rotation(const Vector& x,const Vector& y,const Vector& z);
314 inline Rotation(const Rotation& arg);
315
316 inline Rotation& operator=(const Rotation& arg);
317
319
320 inline Vector operator*(const Vector& v) const;
321
323 inline double& operator()(int i,int j);
324
326 inline double operator() (int i,int j) const;
328 friend Rotation operator *(const Rotation& lhs,const Rotation& rhs);
329
331 inline void SetInverse();
332
334 inline Rotation Inverse() const;
335
336 //! The same as R.Inverse()*v but more efficient.
337 inline Vector Inverse(const Vector& v) const;
338
340 inline Wrench Inverse(const Wrench& arg) const;
341
343 inline Twist Inverse(const Twist& arg) const;
344
346 inline static Rotation Identity();
347
348
349// = Rotations
350
351 inline static Rotation RotX(double angle);
353 inline static Rotation RotY(double angle);
355 inline static Rotation RotZ(double angle);
356 //! The DoRot... functions apply a rotation R to *this,such that *this = *this * Rot..
357 //! DoRot... functions are only defined when they can be executed more efficiently
358 inline void DoRotX(double angle);
360
361 inline void DoRotY(double angle);
362 //! The DoRot... functions apply a rotation R to *this,such that *this = *this * Rot..
363 //! DoRot... functions are only defined when they can be executed more efficiently
364 inline void DoRotZ(double angle);
365
366
367 //! returns identity rotation matrix in the case that the norm of rotvec
368 //! is to small to be used.
369 // @see Rot2 if you want to handle this error in another way.
370 static Rotation Rot(const Vector& rotvec,double angle);
371
373 static Rotation Rot2(const Vector& rotvec,double angle);
374
377 Vector GetRot() const;
378
380 * @param axis the rotation axis is returned in this variable
381 * @param eps : in the case of angle == 0 : rot axis is undefined and chosen
382 * to be +/- Z-axis
383 * in the case of angle == PI : 2 solutions, positive Z-component
384 * of the axis is chosen.
385 * @result returns the rotation angle (between [0..PI] )
386 */
387 double GetRotAngle(Vector& axis,double eps=epsilon) const;
388
394
395 * - EulerZYX(alpha,beta,gamma) == EulerZYX(alpha +/- PHI, -beta, gamma +/- PI)
396 * - (angle + 2*k*PI)
397 **/
398 static Rotation EulerZYZ(double Alfa,double Beta,double Gamma);
399
400
401 First rotate around Z with alpha,
402 then around the new Y with beta, then around
403 new Z with gamma.
404
405 Variables are bound by:
406 - (-PI < alpha <= PI),
407 - (0 <= beta <= PI),
408 - (-PI < gamma <= PI)
409
410 if beta==0 or beta==PI, then alpha and gamma are not unique, in this case gamma is chosen to be zero.
411 Invariants:
412 - EulerZYX(alpha,beta,gamma) == EulerZYX(alpha +/- PI, -beta, gamma +/- PI)
413 - angle + 2*k*PI
414 */
415 void GetEulerZYZ(double& alpha,double& beta,double& gamma) const;
416
417
418 //! the norm of (x,y,z,w) should be equal to 1
419 static Rotation Quaternion(double x,double y,double z, double w);
420
422
423 void GetQuaternion(double& x,double& y,double& z, double& w) const;
424
427
429 * old Y with pitch, then around old Z with yaw
430 *
431 * Invariants:
432 * - RPY(roll,pitch,yaw) == RPY( roll +/- PI, PI-pitch, yaw +/- PI )
433 * - angles + 2*k*PI
434 */
435 static Rotation RPY(double roll,double pitch,double yaw);
439
442 convention :
443 - first rotate around X with roll,
444 - then around the old Y with pitch,
445 - then around old Z with yaw
446
447 if pitch == PI/2 or pitch == -PI/2, multiple solutions for gamma and alpha exist. The solution where roll==0
448 is chosen.
449
450 Invariants:
451 - RPY(roll,pitch,yaw) == RPY( roll +/- PI, PI-pitch, yaw +/- PI )
452 - angles + 2*k*PI
453
454**/
455 void GetRPY(double& roll,double& pitch,double& yaw) const;
456
457
458
459 * - First rotate around Z with alfa,
460 * - then around the new Y with beta,
461 * - then around new X with gamma.
462 *
463 * Closely related to RPY-convention.
464 *
465 * Invariants:
466 * - EulerZYX(alpha,beta,gamma) == EulerZYX(alpha +/- PI, PI-beta, gamma +/- PI)
467 * - (angle + 2*k*PI)
468 **/
469 inline static Rotation EulerZYX(double Alfa,double Beta,double Gamma) {
470 return RPY(Gamma,Beta,Alfa);
471 }
472
475
476 * new X with gamma.
477 *
478 * Range of the results of GetEulerZYX :
479 * - -PI <= alfa <= PI
480 * - -PI <= gamma <= PI
481 * - -PI/2 <= beta <= PI/2
482 *
483 * if beta == PI/2 or beta == -PI/2, multiple solutions for gamma and alpha exist. The solution where gamma==0
484 * is chosen.
485 *
486 *
487 * Invariants:
488 * - EulerZYX(alpha,beta,gamma) == EulerZYX(alpha +/- PI, PI-beta, gamma +/- PI)
489 * - and also (angle + 2*k*PI)
490 *
491 * Closely related to RPY-convention.
492 **/
493 inline void GetEulerZYX(double& Alfa,double& Beta,double& Gamma) const {
494 GetRPY(Gamma,Beta,Alfa);
495 }
496
498
499 //! @see Frame*Twist for a transformation that also transforms
500 //! the velocity reference point.
501 inline Twist operator * (const Twist& arg) const;
502
507 inline Wrench operator * (const Wrench& arg) const;
508
509 //! Access to the underlying unitvectors of the rotation matrix
510 inline Vector UnitX() const {
511 return Vector(data[0],data[3],data[6]);
512 }
513
515 inline void UnitX(const Vector& X) {
516 data[0] = X(0);
517 data[3] = X(1);
518 data[6] = X(2);
519 }
520
521 //! Access to the underlying unitvectors of the rotation matrix
522 inline Vector UnitY() const {
523 return Vector(data[1],data[4],data[7]);
524 }
525
526
527 inline void UnitY(const Vector& X) {
528 data[1] = X(0);
529 data[4] = X(1);
530 data[7] = X(2);
531 }
532
534 inline Vector UnitZ() const {
535 return Vector(data[2],data[5],data[8]);
537
539 inline void UnitZ(const Vector& X) {
540 data[2] = X(0);
541 data[5] = X(1);
542 data[8] = X(2);
543 }
544
545 //! do not use operator == because the definition of Equal(.,.) is slightly
546 //! different. It compares whether the 2 arguments are equal in an eps-interval
547 friend bool Equal(const Rotation& a,const Rotation& b,double eps);
548
550 friend bool operator==(const Rotation& a,const Rotation& b);
552 friend bool operator!=(const Rotation& a,const Rotation& b);
554 friend class Frame;
555};
556 bool operator==(const Rotation& a,const Rotation& b);
557 bool Equal(const Rotation& a,const Rotation& b,double eps=epsilon);
558
559
560
570class Frame {
571public:
574
575public:
576
577 inline Frame(const Rotation& R,const Vector& V);
578
580 explicit inline Frame(const Vector& V);
582 explicit inline Frame(const Rotation& R);
583
584 inline Frame() {}
586 inline Frame(const Frame& arg);
587
588
589 //\TODO should be formulated as a constructor
590 void Make4x4(double* d);
591
594 inline double operator()(int i,int j);
595
598 inline double operator() (int i,int j) const;
599
600// = Inverse
602 inline Frame Inverse() const;
603
604
605 inline Vector Inverse(const Vector& arg) const;
608 inline Wrench Inverse(const Wrench& arg) const;
609
611 inline Twist Inverse(const Twist& arg) const;
612
614 inline Frame& operator = (const Frame& arg);
615
616
616 //! Transformation of the base to which the vector
617 //! is expressed.
618 inline Vector operator * (const Vector& arg) const;
619
621
625 //! Complexity : 24M+18A
626 inline Wrench operator * (const Wrench& arg) const;
627
634 inline Twist operator * (const Twist& arg) const;
635
637 inline friend Frame operator *(const Frame& lhs,const Frame& rhs);
640 inline static Frame Identity();
641
644
645 inline void Integrate(const Twist& t_this,double frequency);
646
647 /*
648 // DH_Craig1989 : constructs a transformationmatrix
649 // T_link(i-1)_link(i) with the Denavit-Hartenberg convention as
650 // described in the Craigs book: Craig, J. J.,Introduction to
651 // Robotics: Mechanics and Control, Addison-Wesley,
652 // isbn:0-201-10326-5, 1986.
653 //
654 // Note that the frame is a redundant way to express the information
655 // in the DH-convention.
656 // \verbatim
657 // Parameters in full : a(i-1),alpha(i-1),d(i),theta(i)
658 //
659 // axis i-1 is connected by link i-1 to axis i numbering axis 1
660 // to axis n link 0 (immobile base) to link n
661 //
662 // link length a(i-1) length of the mutual perpendicular line
663 // (normal) between the 2 axes. This normal runs from (i-1) to
664 // (i) axis.
665 //
666 // link twist alpha(i-1): construct plane perpendicular to the
667 // normal project axis(i-1) and axis(i) into plane angle from
668 // (i-1) to (i) measured in the direction of the normal
669 //
670 // link offset d(i) signed distance between normal (i-1) to (i)
671 // and normal (i) to (i+1) along axis i joint angle theta(i)
672 // signed angle between normal (i-1) to (i) and normal (i) to
673 // (i+1) along axis i
674 //
675 // First and last joints : a(0)= a(n) = 0
676 // alpha(0) = alpha(n) = 0
677 //
678 // PRISMATIC : theta(1) = 0 d(1) arbitrarily
679 //
680 // REVOLUTE : theta(1) arbitrarily d(1) = 0
681 //
682 // Not unique : if intersecting joint axis 2 choices for normal
683 // Frame assignment of the DH convention : Z(i-1) follows axis
684 // (i-1) X(i-1) is the normal between axis(i-1) and axis(i)
685 // Y(i-1) follows out of Z(i-1) and X(i-1)
686 //
687 // a(i-1) = distance from Z(i-1) to Z(i) along X(i-1)
688 // alpha(i-1) = angle between Z(i-1) to Z(i) along X(i-1)
689 // d(i) = distance from X(i-1) to X(i) along Z(i)
690 // theta(i) = angle between X(i-1) to X(i) along X(i)
691 // \endverbatim
692 */
693 static Frame DH_Craig1989(double a,double alpha,double d,double theta);
694
695 // DH : constructs a transformationmatrix T_link(i-1)_link(i) with
696 // the Denavit-Hartenberg convention as described in the original
697 // publictation: Denavit, J. and Hartenberg, R. S., A kinematic
698 // notation for lower-pair mechanisms based on matrices, ASME
699 // Journal of Applied Mechanics, 23:215-221, 1955.
700
701 static Frame DH(double a,double alpha,double d,double theta);
702
703
704
706 inline friend bool Equal(const Frame& a,const Frame& b,double eps);
707
708 //! The literal equality operator==(), also identical.
709 inline friend bool operator==(const Frame& a,const Frame& b);
711 inline friend bool operator!=(const Frame& a,const Frame& b);
712};
713
716
720class Twist {
721public:
724public:
725
726 //! The default constructor initialises to Zero via the constructor of Vector.
727 Twist():vel(),rot() {};
728
729 Twist(const Vector& _vel,const Vector& _rot):vel(_vel),rot(_rot) {};
730
731 inline Twist& operator-=(const Twist& arg);
732 inline Twist& operator+=(const Twist& arg);
734 inline double& operator()(int i);
735
736
738 inline double operator()(int i) const;
739
740 double operator[] ( int index ) const
741 {
742 return this->operator() ( index );
743 }
744
745 double& operator[] ( int index )
747 return this->operator() ( index );
748 }
749
750 inline friend Twist operator*(const Twist& lhs,double rhs);
751 inline friend Twist operator*(double lhs,const Twist& rhs);
752 inline friend Twist operator/(const Twist& lhs,double rhs);
753 inline friend Twist operator+(const Twist& lhs,const Twist& rhs);
754 inline friend Twist operator-(const Twist& lhs,const Twist& rhs);
755 inline friend Twist operator-(const Twist& arg);
756 inline friend double dot(const Twist& lhs,const Wrench& rhs);
757 inline friend double dot(const Wrench& rhs,const Twist& lhs);
758 inline friend void SetToZero(Twist& v);
760 inline friend Twist operator*(const Twist& lhs,const Twist& rhs);
761 /// Spatial cross product for 6d force vectors, beware all of them have to be expressed in the same reference frame/point
762 inline friend Wrench operator*(const Twist& lhs,const Wrench& rhs);
763
765 static inline Twist Zero();
768 inline void ReverseSign();
769
770
771 //! The vector v_base_AB is expressed in the same base as the twist
772 //! The vector v_base_AB is a vector from the old point to
773 //! the new point.
774 //!
775 //! Complexity : 6M+6A
776 inline Twist RefPoint(const Vector& v_base_AB) const;
777
781 inline friend bool Equal(const Twist& a,const Twist& b,double eps);
782
784 inline friend bool operator==(const Twist& a,const Twist& b);
785 //! The literal inequality operator!=().
786 inline friend bool operator!=(const Twist& a,const Twist& b);
787
788// = Friends
789 friend class Rotation;
790 friend class Frame;
791
792};
793
794/**
795 * \brief represents both translational and rotational acceleration.
796 *
797 * This class represents an acceleration twist. A acceleration twist is
798 * the combination of translational
799 * acceleration and rotational acceleration applied at one point.
802class AccelerationTwist {
803public:
804 Vector trans; //!< The translational acceleration of that point
805 Vector rot; //!< The rotational acceleration of that point.
806public:
809 AccelerationTwist():trans(),rot() {};
810
811 AccelerationTwist(const Vector& _trans,const Vector& _rot):trans(_trans),rot(_rot) {};
812
813 inline AccelerationTwist& operator-=(const AccelerationTwist& arg);
814 inline AccelerationTwist& operator+=(const AccelerationTwist& arg);
816 inline double& operator()(int i);
817
818
820 inline double operator()(int i) const;
821
822 double operator[] ( int index ) const
823 {
824 return this->operator() ( index );
825 }
827 double& operator[] ( int index )
828 {
829 return this->operator() ( index );
830 }
831
832 inline friend AccelerationTwist operator*(const AccelerationTwist& lhs,double rhs);
833 inline friend AccelerationTwist operator*(double lhs,const AccelerationTwist& rhs);
834 inline friend AccelerationTwist operator/(const AccelerationTwist& lhs,double rhs);
835 inline friend AccelerationTwist operator+(const AccelerationTwist& lhs,const AccelerationTwist& rhs);
836 inline friend AccelerationTwist operator-(const AccelerationTwist& lhs,const AccelerationTwist& rhs);
837 inline friend AccelerationTwist operator-(const AccelerationTwist& arg);
838 //inline friend double dot(const AccelerationTwist& lhs,const Wrench& rhs);
839 //inline friend double dot(const Wrench& rhs,const AccelerationTwist& lhs);
840 inline friend void SetToZero(AccelerationTwist& v);
841
842
844 static inline AccelerationTwist Zero();
845
847 inline void ReverseSign();
851
852 //! the new point.
853 //!
854 //! Complexity : 6M+6A
855 inline AccelerationTwist RefPoint(const Vector& v_base_AB) const;
856
860 inline friend bool Equal(const AccelerationTwist& a,const AccelerationTwist& b,double eps=epsilon);
863 inline friend bool operator==(const AccelerationTwist& a,const AccelerationTwist& b);
865 inline friend bool operator!=(const AccelerationTwist& a,const AccelerationTwist& b);
866
867// = Friends
868 friend class Rotation;
869 friend class Frame;
870
872*/
874
876 * This class represents a Wrench. A Wrench is the force and torque applied at a point
877 */
880public:
883public:
884
887 Wrench(const Vector& _force,const Vector& _torque):force(_force),torque(_torque) {};
888
889// = Operators
890 inline Wrench& operator-=(const Wrench& arg);
891 inline Wrench& operator+=(const Wrench& arg);
892
894 inline double& operator()(int i);
895
896
897 //! for use with a const Wrench
898 inline double operator()(int i) const;
899
900 double operator[] ( int index ) const
902 return this->operator() ( index );
903 }
904
905 double& operator[] ( int index )
906 {
907 return this->operator() ( index );
908 }
909
910 //! Scalar multiplication
911 inline friend Wrench operator*(const Wrench& lhs,double rhs);
912
913 inline friend Wrench operator*(double lhs,const Wrench& rhs);
915 inline friend Wrench operator/(const Wrench& lhs,double rhs);
916
917 inline friend Wrench operator+(const Wrench& lhs,const Wrench& rhs);
918 inline friend Wrench operator-(const Wrench& lhs,const Wrench& rhs);
921 inline friend Wrench operator-(const Wrench& arg);
922
924
925 inline friend void SetToZero(Wrench& v);
926
928 static inline Wrench Zero();
929
930
931 inline void ReverseSign();
932
935
936 //! the new point.
937 //!
938 //! Complexity : 6M+6A
939 inline Wrench RefPoint(const Vector& v_base_AB) const;
940
944 inline friend bool Equal(const Wrench& a,const Wrench& b,double eps);
945
946 //! The literal equality operator==(), also identical.
947 inline friend bool operator==(const Wrench& a,const Wrench& b);
949 inline friend bool operator!=(const Wrench& a,const Wrench& b);
950
951 friend class Rotation;
952 friend class Frame;
953
954
955};
956
957
961 double data[2];
962public:
964 Vector2() {data[0]=data[1] = 0.0;}
965 inline Vector2(double x,double y);
966 inline Vector2(const Vector2& arg);
968 inline Vector2& operator = ( const Vector2& arg);
969
971 inline double operator()(int index) const;
972
973
974 inline double& operator() (int index);
975
977 double operator[] ( int index ) const
978 {
979 return this->operator() ( index );
980 }
981
983 double& operator[] ( int index )
984 {
985 return this->operator() ( index );
986 }
987
988 inline double x() const;
989 inline double y() const;
990 inline void x(double);
991 inline void y(double);
992
993 inline void ReverseSign();
994 inline Vector2& operator-=(const Vector2& arg);
995 inline Vector2& operator +=(const Vector2& arg);
996
997
998 inline friend Vector2 operator*(const Vector2& lhs,double rhs);
999 inline friend Vector2 operator*(double lhs,const Vector2& rhs);
1000 inline friend Vector2 operator/(const Vector2& lhs,double rhs);
1001 inline friend Vector2 operator+(const Vector2& lhs,const Vector2& rhs);
1002 inline friend Vector2 operator-(const Vector2& lhs,const Vector2& rhs);
1003 inline friend Vector2 operator*(const Vector2& lhs,const Vector2& rhs);
1004 inline friend Vector2 operator-(const Vector2& arg);
1005 inline friend void SetToZero(Vector2& v);
1006
1008 inline static Vector2 Zero();
1009
1010
1013 * if this is not good, check the return value of this method.
1014 */
1015 double Normalize(double eps=epsilon);
1016
1017 //! @return the norm of the vector
1018 double Norm(double eps=epsilon) const;
1019
1020
1021 inline void Set3DXY(const Vector& v);
1022
1024 inline void Set3DYZ(const Vector& v);
1025
1027 inline void Set3DZX(const Vector& v);
1028
1032 inline void Set3DPlane(const Frame& F_someframe_XY,const Vector& v_someframe);
1034
1037 inline friend bool Equal(const Vector2& a,const Vector2& b,double eps);
1038
1040 inline friend bool operator==(const Vector2& a,const Vector2& b);
1042 inline friend bool operator!=(const Vector2& a,const Vector2& b);
1043
1044 friend class Rotation2;
1046
1047
1049
1051{
1052 double s,c;
1054
1055public:
1057 Rotation2() {c=1.0;s=0.0;}
1058
1059 explicit Rotation2(double angle_rad):s(sin(angle_rad)),c(cos(angle_rad)) {}
1061 Rotation2(double ca,double sa):s(sa),c(ca){}
1062
1063 Rotation2(const Rotation2& arg);
1065 inline Rotation2& operator=(const Rotation2& arg);
1066 inline Vector2 operator*(const Vector2& v) const;
1068 inline double operator() (int i,int j) const;
1070 inline friend Rotation2 operator *(const Rotation2& lhs,const Rotation2& rhs);
1071
1072 inline void SetInverse();
1073 inline Rotation2 Inverse() const;
1074 inline Vector2 Inverse(const Vector2& v) const;
1075
1076 inline void SetIdentity();
1077 inline static Rotation2 Identity();
1078
1079
1080
1081 inline void SetRot(double angle);
1082
1084 inline static Rotation2 Rot(double angle);
1085
1087 inline double GetRot() const;
1088
1091 inline friend bool Equal(const Rotation2& a,const Rotation2& b,double eps);
1092};
1093
1097 {
1098public:
1101
1102public:
1103
1104 inline Frame2(const Rotation2& R,const Vector2& V);
1105 explicit inline Frame2(const Vector2& V);
1106 explicit inline Frame2(const Rotation2& R);
1107 inline Frame2(void);
1108 inline Frame2(const Frame2& arg);
1109 inline void Make4x4(double* d);
1110
1113 inline double operator()(int i,int j);
1114
1117 inline double operator() (int i,int j) const;
1118
1119 inline void SetInverse();
1120 inline Frame2 Inverse() const;
1121 inline Vector2 Inverse(const Vector2& arg) const;
1122 inline Frame2& operator = (const Frame2& arg);
1123 inline Vector2 operator * (const Vector2& arg) const;
1124 inline friend Frame2 operator *(const Frame2& lhs,const Frame2& rhs);
1125 inline void SetIdentity();
1126 inline void Integrate(const Twist& t_this,double frequency);
1127 inline static Frame2 Identity() {
1128 Frame2 tmp;
1129 tmp.SetIdentity();
1130 return tmp;
1131 }
1132 inline friend bool Equal(const Frame2& a,const Frame2& b,double eps);
1133};
1138
1140 * \param p_w_a start vector a expressed to some frame w
1141 * \param p_w_b end vector b expressed to some frame w .
1142 * \param dt [optional][obsolete] time interval over which the numerical differentiation takes place.
1143 * \return the difference (b-a) expressed to the frame w.
1144 */
1145IMETHOD Vector diff(const Vector& p_w_a,const Vector& p_w_b,double dt=1);
1146
1147
1148
1149 * determines the (scaled) rotation axis necessary to rotate from b1 to b2.
1150 *
1151 * This rotation axis is expressed w.r.t. frame a. The rotation axis is scaled
1152 * by the necessary rotation angle. The rotation angle is always in the
1153 * (inclusive) interval \f$ [0 , \pi] \f$.
1154 *
1155 * This definition is chosen in this way to facilitate numerical differentiation.
1156 * With this definition diff(a,b) == -diff(b,a).
1158 * The diff() function is overloaded for all classes in frames.hpp and framesvel.hpp, such that
1159 * numerical differentiation, equality checks with tolerances, etc. can be performed
1160 * without caring exactly on which type the operation is performed.
1162 * \param R_a_b1: The rotation matrix \f$ _a^{b1} R \f$ of b1 with respect to frame a.
1163 * \param R_a_b2: The Rotation matrix \f$ _a^{b2} R \f$ of b2 with respect to frame a.
1164 * \param dt [optional][obsolete] time interval over which the numerical differentiation takes place. By default this is set to 1.0.
1165 * \return rotation axis to rotate from b1 to b2, scaled by the rotation angle, expressed in frame a.
1166 * \warning - The result is not a rotational vector, i.e. it is not a mathematical vector.
1167 * (no communitative addition).
1168 *
1169 * \warning - When used in the context of numerical differentiation, with the frames b1 and b2 very
1170 * close to each other, the semantics correspond to the twist, scaled by the time.
1171 *
1172 * \warning - For angles equal to \f$ \pi \f$, The negative of the
1173 * return value is equally valid.
1174 */
1175IMETHOD Vector diff(const Rotation& R_a_b1,const Rotation& R_a_b2,double dt=1);
1176
1185IMETHOD Twist diff(const Frame& F_a_b1,const Frame& F_a_b2,double dt=1);
1186
1191IMETHOD Twist diff(const Twist& a,const Twist& b,double dt=1);
1192
1197IMETHOD Wrench diff(const Wrench& W_a_p1,const Wrench& W_a_p2,double dt=1);
1198
1206IMETHOD Vector addDelta(const Vector& p_w_a,const Vector& p_w_da,double dt=1);
1207
1215 * \param da_w axis and angle of the rotation expressed to some frame w.
1216 * \returns the rotation matrix resulting from the rotation of frame a by the axis and angle
1217 * specified with da. The resulting rotation matrix is expressed with respect to
1218 * frame w.
1219 */
1220IMETHOD Rotation addDelta(const Rotation& R_w_a,const Vector& da_w,double dt=1);
1221
1224
1224 * specified in da_w and the translation of the origin (also specified in da_w).
1225 *
1226 * see also the corresponding diff() routine.
1227 * \param R_w_a Rotation matrix of frame a expressed to some frame w.
1228 * \param da_w axis and angle of the rotation (da_w.rot), together with a displacement vector for the origin (da_w.vel), expressed to some frame w.
1229 * \returns the frame resulting from the rotation of frame a by the axis and angle
1230 * specified with da.rot, and the translation of the origin da_w.vel . The resulting frame is expressed with respect to frame w.
1231 */
1232IMETHOD Frame addDelta(const Frame& F_w_a,const Twist& da_w,double dt=1);
1233
1238
1239 * \returns The twist (a+da) wrt the corresponding frame.
1240 */
1241IMETHOD Twist addDelta(const Twist& a,const Twist&da,double dt=1);
1242
1243
1245 * \brief adds the wrench da to the wrench w.
1246 * see also the corresponding diff() routine.
1247 * see also the corresponding diff() routine.
1248 * \param a a wrench wrt some frame
1249 * \param da a wrench difference wrt some frame
1250 * \returns the wrench (a+da) wrt the corresponding frame.
1251 */
1252IMETHOD Wrench addDelta(const Wrench& a,const Wrench&da,double dt=1);
1254#ifdef KDL_INLINE
1255#include "frames.inl"
1256#endif
1257
1259
1260
1261#endif
A 2D frame class, for further documentation see the Frames class for methods with unchanged semantics...
Definition frames.hpp:1097
void SetIdentity()
Definition frames.hpp:946
Vector2 operator*(const Vector2 &arg) const
Definition frames.hpp:936
double operator()(int i, int j)
Treats a frame as a 3x3 matrix and returns element i,j Access to elements 0..2,0.....
Definition frames.hpp:979
friend bool Equal(const Frame2 &a, const Frame2 &b, double eps)
Definition frames.hpp:1064
Frame2(const Rotation2 &R, const Vector2 &V)
Definition frames.hpp:925
static Frame2 Identity()
Definition frames.hpp:1127
Frame2 & operator=(const Frame2 &arg)
Definition frames.hpp:967
void Integrate(const Twist &t_this, double frequency)
Frame2(void)
Definition frames.hpp:910
Rotation2 M
Orientation of the Frame.
Definition frames.hpp:1100
Vector2 p
origine of the Frame
Definition frames.hpp:1099
void SetInverse()
Definition frames.hpp:952
void Make4x4(double *d)
Frame2 Inverse() const
Definition frames.hpp:960
Definition frames.hpp:570
static Frame DH_Craig1989(double a, double alpha, double d, double theta)
Definition frames.cpp:53
static Frame Identity()
Definition frames.hpp:701
Rotation M
Orientation of the Frame.
Definition frames.hpp:573
void Make4x4(double *d)
Reads data from an double array.
Definition frames.cpp:39
void Integrate(const Twist &t_this, double frequency)
The twist <t_this> is expressed wrt the current frame.
Definition frames.hpp:625
Frame & operator=(const Frame &arg)
Normal copy-by-value semantics.
Definition frames.hpp:429
friend bool Equal(const Frame &a, const Frame &b, double eps)
do not use operator == because the definition of Equal(.,.) is slightly different.
Definition frames.hpp:1040
Frame(const Rotation &R, const Vector &V)
Definition frames.hpp:401
static Frame DH(double a, double alpha, double d, double theta)
Definition frames.cpp:70
friend bool operator==(const Frame &a, const Frame &b)
The literal equality operator==(), also identical.
Definition frames.hpp:1276
Vector operator*(const Vector &arg) const
Transformation of the base to which the vector is expressed.
Definition frames.hpp:413
Vector p
origine of the Frame
Definition frames.hpp:572
Frame Inverse() const
Gives back inverse transformation of a Frame.
Definition frames.hpp:423
double operator()(int i, int j)
Treats a frame as a 4x4 matrix and returns element i,j Access to elements 0..3,0.....
Definition frames.hpp:668
Frame()
Definition frames.hpp:584
friend bool operator!=(const Frame &a, const Frame &b)
The literal inequality operator!=().
Definition frames.hpp:1285
A 2D Rotation class, for conventions see Rotation.
Definition frames.hpp:1051
double GetRot() const
Gets the angle (in radians)
Definition frames.hpp:905
Vector2 operator*(const Vector2 &v) const
Definition frames.hpp:857
double operator()(int i, int j) const
Access to elements 0..1,0..1, bounds are checked when NDEBUG is not set.
Definition frames.hpp:861
Rotation2(double ca, double sa)
Definition frames.hpp:1061
static Rotation2 Rot(double angle)
The Rot... static functions give the value of the appropriate rotation matrix bac.
Definition frames.hpp:901
void SetInverse()
Definition frames.hpp:875
Rotation2()
c,s represent cos(angle), sin(angle), this also represents first col.
Definition frames.hpp:1057
static Rotation2 Identity()
Definition frames.hpp:887
double s
Definition frames.hpp:1052
double c
Definition frames.hpp:1052
friend bool Equal(const Rotation2 &a, const Rotation2 &b, double eps)
do not use operator == because the definition of Equal(.,.) is slightly different.
Definition frames.hpp:1060
void SetIdentity()
Definition frames.hpp:891
Rotation2(double angle_rad)
Definition frames.hpp:1059
Rotation2 Inverse() const
Definition frames.hpp:879
void SetRot(double angle)
The SetRot.. functions set the value of *this to the appropriate rotation matrix.
Definition frames.hpp:897
Rotation2 & operator=(const Rotation2 &arg)
Definition frames.hpp:852
represents rotations in 3 dimensional space.
Definition frames.hpp:302
void GetEulerZYZ(double &alpha, double &beta, double &gamma) const
Gives back the EulerZYZ convention description of the rotation matrix : First rotate around Z with al...
Definition frames.cpp:275
Vector GetRot() const
Returns a vector with the direction of the equiv.
Definition frames.cpp:336
void GetRPY(double &roll, double &pitch, double &yaw) const
Gives back a vector in RPY coordinates, variables are bound by.
Definition frames.cpp:249
void DoRotZ(double angle)
The DoRot... functions apply a rotation R to *this,such that *this = *this * Rot.
Definition frames.hpp:589
Rotation Inverse() const
Gives back the inverse rotation matrix of *this.
Definition frames.hpp:638
Rotation & operator=(const Rotation &arg)
Definition frames.hpp:521
Vector operator*(const Vector &v) const
Defines a multiplication R*V between a Rotation R and a Vector V.
Definition frames.hpp:527
Vector UnitY() const
Access to the underlying unitvectors of the rotation matrix.
Definition frames.hpp:522
void UnitZ(const Vector &X)
Access to the underlying unitvectors of the rotation matrix.
Definition frames.hpp:539
static Rotation Quaternion(double x, double y, double z, double w)
Gives back a rotation matrix specified with Quaternion convention the norm of (x,y,...
Definition frames.cpp:190
Vector UnitZ() const
Access to the underlying unitvectors of the rotation matrix.
Definition frames.hpp:534
Vector UnitX() const
Access to the underlying unitvectors of the rotation matrix.
Definition frames.hpp:510
Rotation()
Definition frames.hpp:306
double GetRotAngle(Vector &axis, double eps=epsilon) const
Returns the rotation angle around the equiv.
Definition frames.cpp:358
static Rotation EulerZYX(double Alfa, double Beta, double Gamma)
EulerZYX constructs a Rotation from the Euler ZYX parameters:
Definition frames.hpp:469
static Rotation Rot2(const Vector &rotvec, double angle)
Along an arbitrary axes. rotvec should be normalized.
Definition frames.cpp:303
static Rotation Identity()
Gives back an identity rotaton matrix.
Definition frames.hpp:553
static Rotation RotX(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
Definition frames.hpp:606
friend bool operator==(const Rotation &a, const Rotation &b)
The literal equality operator==(), also identical.
Definition frames.cpp:430
friend bool operator!=(const Rotation &a, const Rotation &b)
The literal inequality operator!=()
Definition frames.hpp:1328
void UnitX(const Vector &X)
Access to the underlying unitvectors of the rotation matrix.
Definition frames.hpp:515
void DoRotX(double angle)
The DoRot... functions apply a rotation R to *this,such that *this = *this * Rot.
Definition frames.hpp:557
double data[9]
Definition frames.hpp:304
static Rotation RotY(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
Definition frames.hpp:611
void GetQuaternion(double &x, double &y, double &z, double &w) const
Get the quaternion of this matrix.
Definition frames.cpp:204
void SetInverse()
Sets the value of *this to its inverse.
Definition frames.hpp:654
static Rotation Rot(const Vector &rotvec, double angle)
Along an arbitrary axes.
Definition frames.cpp:293
static Rotation EulerZYZ(double Alfa, double Beta, double Gamma)
Gives back a rotation matrix specified with EulerZYZ convention :
Definition frames.cpp:262
void GetEulerZYX(double &Alfa, double &Beta, double &Gamma) const
GetEulerZYX gets the euler ZYX parameters of a rotation : First rotate around Z with alfa,...
Definition frames.hpp:493
friend bool Equal(const Rotation &a, const Rotation &b, double eps)
do not use operator == because the definition of Equal(.,.) is slightly different.
Definition frames.cpp:159
static Rotation RotZ(double angle)
The Rot... static functions give the value of the appropriate rotation matrix back.
Definition frames.hpp:616
friend class Frame
Definition frames.hpp:554
double & operator()(int i, int j)
Access to elements 0..2,0..2, bounds are checked when NDEBUG is not set.
Definition frames.hpp:489
void DoRotY(double angle)
The DoRot... functions apply a rotation R to *this,such that *this = *this * Rot.
Definition frames.hpp:573
static Rotation RPY(double roll, double pitch, double yaw)
Gives back a rotation matrix specified with RPY convention: first rotate around X with roll,...
Definition frames.cpp:237
represents both translational and rotational velocities.
Definition frames.hpp:720
friend Twist operator*(const Twist &lhs, double rhs)
Definition frames.hpp:346
Twist(const Vector &_vel, const Vector &_rot)
Definition frames.hpp:729
Twist & operator+=(const Twist &arg)
Definition frames.hpp:320
double & operator()(int i)
index-based access to components, first vel(0..2), then rot(3..5)
Definition frames.hpp:327
friend double dot(const Twist &lhs, const Wrench &rhs)
Definition frames.hpp:1017
friend bool operator==(const Twist &a, const Twist &b)
The literal equality operator==(), also identical.
Definition frames.hpp:1303
Vector rot
The rotational velocity of that point.
Definition frames.hpp:723
friend Twist operator-(const Twist &lhs, const Twist &rhs)
Definition frames.hpp:367
Twist()
The default constructor initialises to Zero via the constructor of Vector.
Definition frames.hpp:727
friend void SetToZero(Twist &v)
Definition frames.hpp:1072
friend Twist operator/(const Twist &lhs, double rhs)
Definition frames.hpp:356
friend class Rotation
Definition frames.hpp:789
void ReverseSign()
Reverses the sign of the twist.
Definition frames.hpp:297
friend bool Equal(const Twist &a, const Twist &b, double eps)
do not use operator == because the definition of Equal(.,.) is slightly different.
Definition frames.hpp:1050
Twist RefPoint(const Vector &v_base_AB) const
Changes the reference point of the twist.
Definition frames.hpp:303
friend Twist operator+(const Twist &lhs, const Twist &rhs)
Definition frames.hpp:362
Twist & operator-=(const Twist &arg)
Definition frames.hpp:313
double operator[](int index) const
Definition frames.hpp:740
Vector vel
The velocity of that point.
Definition frames.hpp:722
static Twist Zero()
Definition frames.hpp:291
friend class Frame
Definition frames.hpp:790
friend bool operator!=(const Twist &a, const Twist &b)
The literal inequality operator!=().
Definition frames.hpp:1312
2D version of Vector
Definition frames.hpp:960
friend bool operator!=(const Vector2 &a, const Vector2 &b)
The literal inequality operator!=().
Definition frames.hpp:1341
static Vector2 Zero()
Definition frames.hpp:785
friend Vector2 operator-(const Vector2 &lhs, const Vector2 &rhs)
Definition frames.hpp:751
void ReverseSign()
Definition frames.hpp:807
friend Vector2 operator*(const Vector2 &lhs, double rhs)
Definition frames.hpp:756
friend bool Equal(const Vector2 &a, const Vector2 &b, double eps)
do not use operator == because the definition of Equal(.,.) is slightly different.
Definition frames.hpp:1055
friend bool operator==(const Vector2 &a, const Vector2 &b)
The literal equality operator==(), also identical.
Definition frames.hpp:1332
double x() const
Definition frames.hpp:800
void Set3DZX(const Vector &v)
projects v in its ZX plane, and sets *this to these values
Definition frames.hpp:832
Vector2 & operator=(const Vector2 &arg)
Definition frames.hpp:738
double operator[](int index) const
Equivalent to double operator()(int index) const.
Definition frames.hpp:977
double Normalize(double eps=epsilon)
Normalizes this vector and returns it norm makes v a unitvector and returns the norm of v.
Definition frames.cpp:104
void Set3DXY(const Vector &v)
projects v in its XY plane, and sets *this to these values
Definition frames.hpp:820
Vector2()
Does not initialise to Zero().
Definition frames.hpp:964
friend Vector2 operator/(const Vector2 &lhs, double rhs)
Definition frames.hpp:766
friend class Rotation2
Definition frames.hpp:1044
Vector2 & operator+=(const Vector2 &arg)
Definition frames.hpp:771
void Set3DYZ(const Vector &v)
projects v in its YZ plane, and sets *this to these values
Definition frames.hpp:826
friend void SetToZero(Vector2 &v)
Definition frames.hpp:1081
friend Vector2 operator*(const Vector2 &lhs, const Vector2 &rhs)
friend Vector2 operator+(const Vector2 &lhs, const Vector2 &rhs)
Definition frames.hpp:746
Vector2 & operator-=(const Vector2 &arg)
Definition frames.hpp:778
double Norm(double eps=epsilon) const
Definition frames.cpp:87
double operator()(int index) const
Access to elements, range checked when NDEBUG is not set, from 0..1.
Definition frames.hpp:789
double y() const
Definition frames.hpp:801
void Set3DPlane(const Frame &F_someframe_XY, const Vector &v_someframe)
projects v_someframe in the XY plane of F_someframe_XY, and sets *this to these values expressed wrt ...
Definition frames.hpp:839
double data[2]
Definition frames.hpp:961
A concrete implementation of a 3 dimensional vector class.
Definition frames.hpp:161
void Set2DPlane(const Frame &F_someframe_XY, const Vector2 &v_XY)
a 3D vector where the 2D vector v_XY is put in the XY plane of the frame F_someframe_XY.
Definition frames.hpp:708
friend double dot(const Vector &lhs, const Vector &rhs)
Definition frames.hpp:1013
friend bool Equal(const Vector &a, const Vector &b, double eps)
do not use operator == because the definition of Equal(.,.) is slightly different.
Definition frames.hpp:1033
void ReverseSign()
Reverses the sign of the Vector object itself.
Definition frames.hpp:441
friend void SetToZero(Vector &v)
To have a uniform operator to put an element to zero, for scalar values and for objects.
Definition frames.hpp:1069
Vector & operator-=(const Vector &arg)
subtracts a vector from the Vector object itself
Definition frames.hpp:130
friend Vector operator+(const Vector &lhs, const Vector &rhs)
Definition frames.hpp:58
friend Vector operator/(const Vector &lhs, double rhs)
Scalar division is defined.
Definition frames.hpp:102
friend bool operator==(const Vector &a, const Vector &b)
The literal equality operator==(), also identical.
Definition frames.hpp:1289
double z() const
Definition frames.hpp:78
double operator[](int index) const
Equivalent to double operator()(int index) const.
Definition frames.hpp:183
double y() const
Definition frames.hpp:77
void Set2DZX(const Vector2 &v)
a 3D vector where the 2D vector v is put in the ZX plane
Definition frames.hpp:476
Vector & operator+=(const Vector &arg)
Adds a vector from the Vector object itself.
Definition frames.hpp:121
Vector & operator=(const Vector &arg)
Assignment operator. The normal copy by value semantics.
Definition frames.hpp:50
double Normalize(double eps=epsilon)
Normalizes this vector and returns it norm makes v a unitvector and returns the norm of v.
Definition frames.cpp:147
Vector()
Does not initialise the Vector to zero. use Vector::Zero() or SetToZero for that.
Definition frames.hpp:165
double data[3]
Definition frames.hpp:163
double x() const
Definition frames.hpp:76
friend class Rotation
Definition frames.hpp:263
static Vector Zero()
Definition frames.hpp:139
void Set2DXY(const Vector2 &v)
a 3D vector where the 2D vector v is put in the XY plane
Definition frames.hpp:459
double operator()(int index) const
Access to elements, range checked when NDEBUG is not set, from 0..2.
Definition frames.hpp:144
friend Vector operator*(const Vector &lhs, double rhs)
Scalar multiplication is defined.
Definition frames.hpp:84
friend Vector operator-(const Vector &lhs, const Vector &rhs)
Definition frames.hpp:67
double Norm(double eps=epsilon) const
Definition frames.cpp:117
friend bool operator!=(const Vector &a, const Vector &b)
The literal inequality operator!=().
Definition frames.hpp:1299
friend class Frame
Definition frames.hpp:264
void Set2DYZ(const Vector2 &v)
a 3D vector where the 2D vector v is put in the YZ plane
Definition frames.hpp:467
represents both translational and rotational acceleration.
Definition frames.hpp:879
friend bool Equal(const Wrench &a, const Wrench &b, double eps)
do not use operator == because the definition of Equal(.,.) is slightly different.
Definition frames.hpp:1045
Wrench & operator+=(const Wrench &arg)
Definition frames.hpp:217
friend Wrench operator+(const Wrench &lhs, const Wrench &rhs)
Definition frames.hpp:259
Wrench & operator-=(const Wrench &arg)
Definition frames.hpp:210
Vector force
Force that is applied at the origin of the current ref frame.
Definition frames.hpp:881
friend bool operator==(const Wrench &a, const Wrench &b)
The literal equality operator==(), also identical.
Definition frames.hpp:1316
friend Wrench operator/(const Wrench &lhs, double rhs)
Scalar division.
Definition frames.hpp:253
Wrench()
Does initialise force and torque to zero via the underlying constructor of Vector.
Definition frames.hpp:886
static Wrench Zero()
Definition frames.hpp:186
double & operator()(int i)
index-based access to components, first force(0..2), then torque(3..5)
Definition frames.hpp:224
friend Wrench operator-(const Wrench &lhs, const Wrench &rhs)
Definition frames.hpp:264
friend class Rotation
Definition frames.hpp:951
friend bool operator!=(const Wrench &a, const Wrench &b)
The literal inequality operator!=().
Definition frames.hpp:1325
Vector torque
Torque that is applied at the origin of the current ref frame.
Definition frames.hpp:882
double operator[](int index) const
Definition frames.hpp:900
Wrench RefPoint(const Vector &v_base_AB) const
Changes the reference point of the wrench.
Definition frames.hpp:198
friend Wrench operator*(const Wrench &lhs, double rhs)
Scalar multiplication.
Definition frames.hpp:243
friend void SetToZero(Wrench &v)
Sets the Wrench to Zero, to have a uniform function that sets an object or double to zero.
Definition frames.hpp:1076
friend class Frame
Definition frames.hpp:952
void ReverseSign()
Reverses the sign of the current Wrench.
Definition frames.hpp:192
Inlined member functions and global functions that relate to the classes in frames....
Definition articulatedbodyinertia.cpp:26
bool operator==(const Rotation &a, const Rotation &b)
Definition frames.cpp:430
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
determines the difference of vector b with vector a.
Definition frames.hpp:1130
IMETHOD Vector addDelta(const Vector &p_w_a, const Vector &p_w_da, double dt=1)
adds vector da to vector a.
Definition frames.hpp:1157
IMETHOD bool Equal(const FrameAcc &r1, const FrameAcc &r2, double eps=epsilon)
Definition frameacc.hpp:394