KDL::Rotation Class Reference

represents rotations in 3 dimensional space. More...

#include <frames.hpp>

List of all members.

Public Member Functions

void DoRotX (double angle)
 The DoRot.
void DoRotY (double angle)
 The DoRot.
void DoRotZ (double angle)
 The DoRot.
void GetEulerZYX (double &Alfa, double &Beta, double &Gamma) const
 GetEulerZYX gets the euler ZYX parameters of a rotation : First rotate around Z with alfa, then around the new Y with beta, then around new X with gamma.
void GetEulerZYZ (double &alfa, double &beta, double &gamma) const
 Gives back the EulerZYZ convention description of the rotation matrix : First rotate around Z with alfa, then around the new Y with beta, then around new Z with gamma.
void GetQuaternion (double &x, double &y, double &z, double &w) const
 Get the quaternion of this matrix.
Vector GetRot () const
 Returns a vector with the direction of the equiv.
double GetRotAngle (Vector &axis, double eps=epsilon) const
 Returns the rotation angle around the equiv.
void GetRPY (double &roll, double &pitch, double &yaw) const
 Gives back a vector in RPY coordinates, variables are bound by -PI <= roll <= PI -PI <= Yaw <= PI -PI/2 <= PITCH <= PI/2.
Twist Inverse (const Twist &arg) const
 The same as R.Inverse()*arg but more efficient.
Wrench Inverse (const Wrench &arg) const
 The same as R.Inverse()*arg but more efficient.
Vector Inverse (const Vector &v) const
 The same as R.Inverse()*v but more efficient.
Rotation Inverse () const
 Gives back the inverse rotation matrix of *this.
double operator() (int i, int j) const
 Access to elements 0..2,0..2, bounds are checked when NDEBUG is not set.
double & operator() (int i, int j)
 Access to elements 0..2,0..2, bounds are checked when NDEBUG is not set.
Wrench operator* (const Wrench &arg) const
 Transformation of the base to which the wrench is expressed.
Twist operator* (const Twist &arg) const
 Transformation of the base to which the twist is expressed.
Vector operator* (const Vector &v) const
 Defines a multiplication R*V between a Rotation R and a Vector V.
Rotationoperator= (const Rotation &arg)
 Rotation (const Vector &x, const Vector &y, const Vector &z)
 Rotation (double Xx, double Yx, double Zx, double Xy, double Yy, double Zy, double Xz, double Yz, double Zz)
 Rotation ()
void SetInverse ()
 Sets the value of *this to its inverse.
void UnitX (const Vector &X)
 Access to the underlying unitvectors of the rotation matrix.
Vector UnitX () const
 Access to the underlying unitvectors of the rotation matrix.
void UnitY (const Vector &X)
 Access to the underlying unitvectors of the rotation matrix.
Vector UnitY () const
 Access to the underlying unitvectors of the rotation matrix.
void UnitZ (const Vector &X)
 Access to the underlying unitvectors of the rotation matrix.
Vector UnitZ () const
 Access to the underlying unitvectors of the rotation matrix.

Static Public Member Functions

static Rotation EulerZYX (double Alfa, double Beta, double Gamma)
 Gives back a rotation matrix specified with EulerZYX convention : First rotate around Z with alfa, then around the new Y with beta, then around new X with gamma.
static Rotation EulerZYZ (double Alfa, double Beta, double Gamma)
 Gives back a rotation matrix specified with EulerZYZ convention : First rotate around Z with alfa, then around the new Y with beta, then around new Z with gamma.
static Rotation Identity ()
 Gives back an identity rotaton matrix.
static Rotation Quaternion (double x, double y, double z, double w)
 Sets the value of this object to a rotation specified with Quaternion convention the norm of (x,y,z,w) should be equal to 1.
static Rotation Rot (const Vector &rotvec, double angle)
 Along an arbitrary axes.
static Rotation Rot2 (const Vector &rotvec, double angle)
 Along an arbitrary axes. rotvec should be normalized.
static Rotation RotX (double angle)
 The Rot... static functions give the value of the appropriate rotation matrix back.
static Rotation RotY (double angle)
 The Rot... static functions give the value of the appropriate rotation matrix back.
static Rotation RotZ (double angle)
 The Rot... static functions give the value of the appropriate rotation matrix back.
static Rotation RPY (double roll, double pitch, double yaw)
 Sets the value of this object to a rotation specified with RPY convention: first rotate around X with roll, then around the old Y with pitch, then around old Z with alfa.

Public Attributes

double data [9]

Friends

bool Equal (const Rotation &a, const Rotation &b, double eps=epsilon)
 do not use operator == because the definition of Equal(.,.
class Frame
bool operator!= (const Rotation &a, const Rotation &b)
 The literal inequality operator!=().
Rotation operator* (const Rotation &lhs, const Rotation &rhs)
bool operator== (const Rotation &a, const Rotation &b)
 The literal equality operator==(), also identical.

Detailed Description

represents rotations in 3 dimensional space.

This class represents a rotation matrix with the following conventions :

     Suppose V2 = R*V,                                    (1)
     V is expressed in frame B
     V2 is expressed in frame A
     This matrix R consists of 3 collumns [ X,Y,Z ],
     X,Y, and Z contain the axes of frame B, expressed in frame A
     Because of linearity expr(1) is valid.
 

This class only represents rotational_interpolation, not translation Two interpretations are possible for rotation angles. if you rotate with angle around X frame A to have frame B, then the result of SetRotX is equal to frame B expressed wrt A. In code:

      Rotation R;
      F_A_B = R.SetRotX(angle);
 

Secondly, if you take the following code :

      Vector p,p2; Rotation R;
      R.SetRotX(angle);
      p2 = R*p;
 

then the frame p2 is rotated around X axis with (-angle). Analogue reasonings can be applyd to SetRotY,SetRotZ,SetRot

type
Concrete implementation

Definition at line 292 of file frames.hpp.


Constructor & Destructor Documentation

KDL::Rotation::Rotation (  )  [inline]

Definition at line 297 of file frames.hpp.

References Identity().

Referenced by EulerZYZ(), Identity(), Quaternion(), Rot2(), RotX(), RotY(), RotZ(), and RPY().

KDL::Rotation::Rotation ( double  Xx,
double  Yx,
double  Zx,
double  Xy,
double  Yy,
double  Zy,
double  Xz,
double  Yz,
double  Zz 
) [inline]

Definition at line 493 of file frames.inl.

References data.

KDL::Rotation::Rotation ( const Vector x,
const Vector y,
const Vector z 
) [inline]

Definition at line 503 of file frames.inl.

References KDL::Vector::data, and data.


Member Function Documentation

void KDL::Rotation::DoRotX ( double  angle  )  [inline]

The DoRot.

.. functions apply a rotation R to *this,such that *this = *this * Rot.. DoRot... functions are only defined when they can be executed more efficiently

Definition at line 546 of file frames.inl.

References KDL::cos(), and KDL::sin().

Referenced by KDL::RotationVel::DoRotX().

void KDL::Rotation::DoRotY ( double  angle  )  [inline]

The DoRot.

.. functions apply a rotation R to *this,such that *this = *this * Rot.. DoRot... functions are only defined when they can be executed more efficiently

Definition at line 562 of file frames.inl.

References KDL::cos(), and KDL::sin().

Referenced by KDL::RotationVel::DoRotY().

void KDL::Rotation::DoRotZ ( double  angle  )  [inline]

The DoRot.

.. functions apply a rotation R to *this,such that *this = *this * Rot.. DoRot... functions are only defined when they can be executed more efficiently

Definition at line 578 of file frames.inl.

References KDL::cos(), and KDL::sin().

Referenced by KDL::RotationVel::DoRotZ().

static Rotation KDL::Rotation::EulerZYX ( double  Alfa,
double  Beta,
double  Gamma 
) [inline, static]

Gives back a rotation matrix specified with EulerZYX convention : First rotate around Z with alfa, then around the new Y with beta, then around new X with gamma.

closely related to RPY-convention

Definition at line 427 of file frames.hpp.

References RPY().

Referenced by KDL::posrandom(), and KDL::random().

Rotation KDL::Rotation::EulerZYZ ( double  Alfa,
double  Beta,
double  Gamma 
) [static]

Gives back a rotation matrix specified with EulerZYZ convention : First rotate around Z with alfa, then around the new Y with beta, then around new Z with gamma.

Definition at line 252 of file frames.cpp.

References KDL::cos(), Rotation(), and KDL::sin().

void KDL::Rotation::GetEulerZYX ( double &  Alfa,
double &  Beta,
double &  Gamma 
) const [inline]

GetEulerZYX gets the euler ZYX parameters of a rotation : First rotate around Z with alfa, then around the new Y with beta, then around new X with gamma.

Range of the results of GetEulerZYX : -PI <= alfa <= PI -PI <= gamma <= PI -PI/2 <= beta <= PI/2

Closely related to RPY-convention.

Definition at line 442 of file frames.hpp.

References GetRPY().

void KDL::Rotation::GetEulerZYZ ( double &  alfa,
double &  beta,
double &  gamma 
) const

Gives back the EulerZYZ convention description of the rotation matrix : First rotate around Z with alfa, then around the new Y with beta, then around new Z with gamma.

Variables are bound by (-PI <= alfa <= PI), (0 <= beta <= PI), (-PI <= alfa <= PI)

Definition at line 265 of file frames.cpp.

References KDL::atan2(), data, KDL::epsilon, KDL::PI, KDL::sqr(), and KDL::sqrt().

void KDL::Rotation::GetQuaternion ( double &  x,
double &  y,
double &  z,
double &  w 
) const

Get the quaternion of this matrix.

Postcondition:
the norm of (x,y,z,w) is 1

Definition at line 195 of file frames.cpp.

References KDL::epsilon, SketcherExample::f, KDL::sqrt(), and Py::trace().

Vector KDL::Rotation::GetRot (  )  const

Returns a vector with the direction of the equiv.

axis and its norm is angle

Definition at line 325 of file frames.cpp.

References KDL::atan2(), data, KDL::epsilon, and KDL::Vector::Norm().

Referenced by KDL::diff().

double KDL::Rotation::GetRotAngle ( Vector axis,
double  eps = epsilon 
) const

Returns the rotation angle around the equiv.

axis

Parameters:
axis the rotation axis is returned in this variable
eps : in the case of angle == 0 : rot axis is undefined and choosen to be +/- Z-axis in the case of angle == PI : 2 solutions, positive Z-component of the axis is choosen.
Returns:
returns the rotation angle (between [0..PI] )

axis

Parameters:
axis the rotation axis is returned in this variable
eps : in the case of angle == 0 : rot axis is undefined and choosen to be +/- Z-axis in the case of angle == PI : 2 solutions, positive Z-component of the axis is choosen.
Returns:
returns the rotation angle (between [0..PI] ) /todo : Check corresponding routines in rframes and rrframes

Definition at line 355 of file frames.cpp.

References KDL::acos(), draftlibs::fcvec::angle(), data, KDL::PI, KDL::sin(), KDL::sqrt(), MovieTool::x, and MovieTool::y.

Referenced by KDL::RotationalInterpolation_SingleAxis::SetStartEnd().

void KDL::Rotation::GetRPY ( double &  roll,
double &  pitch,
double &  yaw 
) const

Gives back a vector in RPY coordinates, variables are bound by -PI <= roll <= PI -PI <= Yaw <= PI -PI/2 <= PITCH <= PI/2.

convention : first rotate around X with roll, then around the old Y with pitch, then around old Z with alfa

Definition at line 239 of file frames.cpp.

References KDL::atan2(), data, KDL::epsilon, KDL::PI, KDL::sign(), KDL::sqr(), and KDL::sqrt().

Referenced by GetEulerZYX().

Rotation KDL::Rotation::Identity (  )  [inline, static]

Gives back an identity rotaton matrix.

Definition at line 542 of file frames.inl.

References Rotation().

Referenced by KDL::RotationVel::Identity(), KDL::Frame::Identity(), KDL::RotationAcc::Identity(), and Rotation().

Twist KDL::Rotation::Inverse ( const Twist arg  )  const [inline]

The same as R.Inverse()*arg but more efficient.

Definition at line 175 of file frames.inl.

References Inverse(), KDL::Twist::rot, and KDL::Twist::vel.

Wrench KDL::Rotation::Inverse ( const Wrench arg  )  const [inline]

The same as R.Inverse()*arg but more efficient.

Definition at line 170 of file frames.inl.

References KDL::Wrench::force, Inverse(), and KDL::Wrench::torque.

Vector KDL::Rotation::Inverse ( const Vector v  )  const [inline]

The same as R.Inverse()*v but more efficient.

Definition at line 634 of file frames.inl.

References KDL::Vector::data, and data.

Rotation KDL::Rotation::Inverse (  )  const [inline]
double KDL::Rotation::operator() ( int  i,
int  j 
) const [inline]

Access to elements 0..2,0..2, bounds are checked when NDEBUG is not set.

Definition at line 488 of file frames.inl.

References data, and FRAMES_CHECKI.

double & KDL::Rotation::operator() ( int  i,
int  j 
) [inline]

Access to elements 0..2,0..2, bounds are checked when NDEBUG is not set.

Definition at line 483 of file frames.inl.

References data, and FRAMES_CHECKI.

Wrench KDL::Rotation::operator* ( const Wrench arg  )  const [inline]

Transformation of the base to which the wrench is expressed.

Complexity : 18M+12A

See also:
Frame*Wrench for a transformation that also transforms the force reference point.

Definition at line 534 of file frames.inl.

Twist KDL::Rotation::operator* ( const Twist arg  )  const [inline]

Transformation of the base to which the twist is expressed.

Complexity : 18M+12A

See also:
Frame*Twist for a transformation that also transforms the velocity reference point.

Definition at line 525 of file frames.inl.

Vector KDL::Rotation::operator* ( const Vector v  )  const [inline]

Defines a multiplication R*V between a Rotation R and a Vector V.

Complexity : 9M+6A

Definition at line 516 of file frames.inl.

References KDL::Vector::data, and data.

Rotation & KDL::Rotation::operator= ( const Rotation arg  )  [inline]

Definition at line 510 of file frames.inl.

References RobotExampleTrajectoryOutOfShapes::count, and data.

Rotation KDL::Rotation::Quaternion ( double  x,
double  y,
double  z,
double  w 
) [static]

Sets the value of this object to a rotation specified with Quaternion convention the norm of (x,y,z,w) should be equal to 1.

Definition at line 181 of file frames.cpp.

References Rotation().

Referenced by Robot::Robot6Axis::setTo(), and Robot::toFrame().

Rotation KDL::Rotation::Rot ( const Vector rotvec,
double  angle 
) [static]

Along an arbitrary axes.

It is not necessary to normalize rotvec. returns identity rotation matrix in the case that the norm of rotvec is to small to be used.

Definition at line 282 of file frames.cpp.

References KDL::Vector::Normalize(), and Rot2().

Referenced by KDL::Frame::Integrate(), and KDL::Path_Line::Path_Line().

Rotation KDL::Rotation::Rot2 ( const Vector rotvec,
double  angle 
) [static]

Along an arbitrary axes. rotvec should be normalized.

Definition at line 292 of file frames.cpp.

References KDL::cos(), Rotation(), and KDL::sin().

Referenced by KDL::Joint::Joint(), KDL::RotationalInterpolation_SingleAxis::Pos(), KDL::Joint::pose(), KDL::RotationVel::Rot(), Rot(), and KDL::RotationVel::Rot2().

Rotation KDL::Rotation::RotX ( double  angle  )  [inline, static]

The Rot... static functions give the value of the appropriate rotation matrix back.

Definition at line 595 of file frames.inl.

References KDL::cos(), Rotation(), and KDL::sin().

Referenced by KDL::Joint::pose(), KDL::RotationVel::RotX(), and KDL::RotationVel::RotY().

Rotation KDL::Rotation::RotY ( double  angle  )  [inline, static]

The Rot... static functions give the value of the appropriate rotation matrix back.

Definition at line 600 of file frames.inl.

References KDL::cos(), Rotation(), and KDL::sin().

Referenced by KDL::Joint::pose().

Rotation KDL::Rotation::RotZ ( double  angle  )  [inline, static]

The Rot... static functions give the value of the appropriate rotation matrix back.

Definition at line 605 of file frames.inl.

References KDL::cos(), Rotation(), and KDL::sin().

Referenced by KDL::Joint::pose(), and KDL::RotationVel::RotZ().

Rotation KDL::Rotation::RPY ( double  roll,
double  pitch,
double  yaw 
) [static]

Sets the value of this object to a rotation specified with RPY convention: first rotate around X with roll, then around the old Y with pitch, then around old Z with alfa.

Definition at line 227 of file frames.cpp.

References KDL::cos(), Rotation(), and KDL::sin().

Referenced by EulerZYX().

void KDL::Rotation::SetInverse (  )  [inline]

Sets the value of *this to its inverse.

Definition at line 643 of file frames.inl.

References data.

Referenced by Inverse().

void KDL::Rotation::UnitX ( const Vector X  )  [inline]

Access to the underlying unitvectors of the rotation matrix.

Definition at line 464 of file frames.hpp.

References data.

Vector KDL::Rotation::UnitX (  )  const [inline]

Access to the underlying unitvectors of the rotation matrix.

Definition at line 459 of file frames.hpp.

References data.

Referenced by KDL::RotationVel::UnitX().

void KDL::Rotation::UnitY ( const Vector X  )  [inline]

Access to the underlying unitvectors of the rotation matrix.

Definition at line 476 of file frames.hpp.

References data.

Vector KDL::Rotation::UnitY (  )  const [inline]

Access to the underlying unitvectors of the rotation matrix.

Definition at line 471 of file frames.hpp.

References data.

Referenced by KDL::Path_Circle::Clone(), KDL::RotationVel::UnitY(), and KDL::Path_Circle::Write().

void KDL::Rotation::UnitZ ( const Vector X  )  [inline]

Access to the underlying unitvectors of the rotation matrix.

Definition at line 488 of file frames.hpp.

References data.

Vector KDL::Rotation::UnitZ (  )  const [inline]

Access to the underlying unitvectors of the rotation matrix.

Definition at line 483 of file frames.hpp.

References data.

Referenced by KDL::RotationVel::UnitZ().


Friends And Related Function Documentation

bool Equal ( const Rotation a,
const Rotation b,
double  eps = epsilon 
) [friend]

do not use operator == because the definition of Equal(.,.

) is slightly different. It compares whether the 2 arguments are equal in an eps-interval

friend class Frame [friend]

Definition at line 503 of file frames.hpp.

bool operator!= ( const Rotation a,
const Rotation b 
) [friend]

The literal inequality operator!=().

Rotation operator* ( const Rotation lhs,
const Rotation rhs 
) [friend]
bool operator== ( const Rotation a,
const Rotation b 
) [friend]

The literal equality operator==(), also identical.


Member Data Documentation


The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:02:18 2011 for FreeCAD by  doxygen 1.6.1