hpp::constraints::GenericTransformation< _Options > Class Template Reference

GenericTransformation class encapsulates 6 possible differentiable functions: Position, Orientation, Transformation and their relative versions RelativePosition, RelativeOrientation, RelativeTransformation. More...

#include <hpp/constraints/generic-transformation.hh>

Inheritance diagram for hpp::constraints::GenericTransformation< _Options >:
[legend]
Collaboration diagram for hpp::constraints::GenericTransformation< _Options >:
[legend]

Public Types

enum  {
  IsRelative = _Options & RelativeBit,
  ComputeOrientation = _Options & OrientationBit,
  ComputePosition = _Options & PositionBit,
  OutputSE3 = _Options & OutputSE3Bit,
  IsPosition = ComputePosition && !ComputeOrientation,
  IsOrientation = !ComputePosition && ComputeOrientation,
  IsTransform = ComputePosition && ComputeOrientation,
  ValueSize = (ComputePosition?3:0) + (ComputeOrientation?(OutputSE3?4:3):0),
  DerSize = (ComputePosition?3:0) + (ComputeOrientation ?3:0)
}
 
typedef boost::shared_ptr< GenericTransformationPtr_t
 
typedef boost::weak_ptr< GenericTransformationWkPtr_t
 

Public Member Functions

virtual ~GenericTransformation ()
 
void reference (const Transform3f &reference)
 Set desired relative transformation of joint2 in joint1. More...
 
Transform3f reference () const
 Get desired relative orientation. More...
 
void joint1 (const JointConstPtr_t &joint)
 Set joint 1. More...
 
JointConstPtr_t joint1 () const
 Get joint 1. More...
 
void joint2 (const JointConstPtr_t &joint)
 Set joint 2. More...
 
JointConstPtr_t joint2 () const
 Get joint 2. More...
 
void frame1InJoint1 (const Transform3f &M)
 Set position of frame 1 in joint 1. More...
 
const Transform3fframe1InJoint1 () const
 Get position of frame 1 in joint 1. More...
 
void frame2InJoint2 (const Transform3f &M)
 Set position of frame 2 in joint 2. More...
 
const Transform3fframe2InJoint2 () const
 Get position of frame 2 in joint 2. More...
 
virtual std::ostream & print (std::ostream &o) const
 Display object in a stream. More...
 
 GenericTransformation (const std::string &name, const DevicePtr_t &robot, std::vector< bool > mask)
 Constructor. More...
 
- Public Member Functions inherited from hpp::constraints::DifferentiableFunction
virtual ~DifferentiableFunction ()
 
LiegroupElement operator() (vectorIn_t argument) const
 Evaluate the function at a given parameter. More...
 
void value (LiegroupElementRef result, vectorIn_t argument) const
 Evaluate the function at a given parameter. More...
 
void jacobian (matrixOut_t jacobian, vectorIn_t argument) const
 Computes the jacobian. More...
 
const ArrayXbactiveParameters () const
 Returns a vector of booleans that indicates whether the corresponding configuration parameter influences this constraints. More...
 
const ArrayXbactiveDerivativeParameters () const
 Returns a vector of booleans that indicates whether the corresponding velocity parameter influences this constraints. More...
 
size_type inputSize () const
 Get dimension of input vector. More...
 
size_type inputDerivativeSize () const
 Get dimension of input derivative vector. More...
 
LiegroupSpacePtr_t outputSpace () const
 Get output element. More...
 
size_type outputSize () const
 Get dimension of output vector. More...
 
size_type outputDerivativeSize () const
 Get dimension of output derivative vector. More...
 
const std::string & name () const
 Get function name. More...
 
std::string context () const
 
void context (const std::string &c)
 
void finiteDifferenceForward (matrixOut_t jacobian, vectorIn_t arg, DevicePtr_t robot=DevicePtr_t(), value_type eps=std::sqrt(Eigen::NumTraits< value_type >::epsilon())) const
 Approximate the jacobian using forward finite difference. More...
 
void finiteDifferenceCentral (matrixOut_t jacobian, vectorIn_t arg, DevicePtr_t robot=DevicePtr_t(), value_type eps=std::sqrt(Eigen::NumTraits< value_type >::epsilon())) const
 Approximate the jacobian using forward finite difference. More...
 

Static Public Member Functions

static Ptr_t create (const std::string &name, const DevicePtr_t &robot, const JointConstPtr_t &joint2, const Transform3f &reference, std::vector< bool > mask=std::vector< bool >(DerSize, true))
 Object builder for absolute functions. More...
 
static Ptr_t create (const std::string &name, const DevicePtr_t &robot, const JointConstPtr_t &joint2, const Transform3f &frame2, const Transform3f &frame1, std::vector< bool > mask=std::vector< bool >(DerSize, true))
 Object builder for absolute functions. More...
 
static Ptr_t create (const std::string &name, const DevicePtr_t &robot, const JointConstPtr_t &joint1, const JointConstPtr_t &joint2, const Transform3f &reference, std::vector< bool > mask=std::vector< bool >(DerSize, true))
 Object builder for relative functions. More...
 
static Ptr_t create (const std::string &name, const DevicePtr_t &robot, const JointConstPtr_t &joint1, const JointConstPtr_t &joint2, const Transform3f &frame1, const Transform3f &frame2, std::vector< bool > mask=std::vector< bool >(DerSize, true))
 Object builder for relative functions. More...
 

Protected Member Functions

void init (const WkPtr_t &self)
 
virtual void impl_compute (LiegroupElementRef result, ConfigurationIn_t argument) const throw ()
 Compute value of error. More...
 
virtual void impl_jacobian (matrixOut_t jacobian, ConfigurationIn_t arg) const throw ()
 
- Protected Member Functions inherited from hpp::constraints::DifferentiableFunction
 DifferentiableFunction (size_type sizeInput, size_type sizeInputDerivative, size_type sizeOutput, std::string name=std::string())
 Concrete class constructor should call this constructor. More...
 
 DifferentiableFunction (size_type sizeInput, size_type sizeInputDerivative, const LiegroupSpacePtr_t &outputSpace, std::string name=std::string())
 Concrete class constructor should call this constructor. More...
 
virtual void impl_compute (LiegroupElementRef result, vectorIn_t argument) const =0
 User implementation of function evaluation. More...
 
virtual void impl_jacobian (matrixOut_t jacobian, vectorIn_t arg) const =0
 

Additional Inherited Members

- Protected Attributes inherited from hpp::constraints::DifferentiableFunction
size_type inputSize_
 Dimension of input vector. More...
 
size_type inputDerivativeSize_
 Dimension of input derivative. More...
 
LiegroupSpacePtr_t outputSpace_
 Dimension of output vector. More...
 
ArrayXb activeParameters_
 Initialized to true by this class. More...
 
ArrayXb activeDerivativeParameters_
 Initialized to true by this class. More...
 

Detailed Description

template<int _Options>
class hpp::constraints::GenericTransformation< _Options >

GenericTransformation class encapsulates 6 possible differentiable functions: Position, Orientation, Transformation and their relative versions RelativePosition, RelativeOrientation, RelativeTransformation.

These functions compute the position of frame GenericTransformation::frame2InJoint2 in joint GenericTransformation::joint2 frame, in the frame GenericTransformation::frame1InJoint1 in GenericTransformation::joint1 frame. For absolute functions, GenericTransformation::joint1 is NULL and joint1 frame is the world frame.

The value of the RelativeTransformation function is a 6-dimensional vector. The 3 first coordinates are the position of the center of the second frame expressed in the first frame. The 3 last coordinates are the log of the orientation of frame 2 in frame 1.

\begin{equation*} f (\mathbf{q}) = \left(\begin{array}{c} \mathbf{translation}\left(T_{1/J_1}^T T_1^T T_2 T_{2/J_2}\right)\\ \log \left((R_1 R_{1/J_1})^T R_2 R_{2/J_2}\right) \end{array}\right) \end{equation*}

The Jacobian is given by

\begin{equation*} \left(\begin{array}{c} (R_1 R_{1/J_1})^T \left(\left[R_2 t_{2/J_2} + t_2 - t_1\right]_{\times} R_1 J_{1\,\omega} - \left[R_2 t_{2/J_2}\right]_{\times} R_2 J_{2\,\omega} + R_2 J_{2\,\mathbf{v}} - R_1 J_{1\,\mathbf{v}}\right) \\ J_{log}\left((R_1 R_{1/J_1})^T R_2 R_{2/J_2}\right)(R_1 R_{1/J_1})^T (R_2 J_{2\,\omega} - R_1 J_{1\,\omega}) \end{array}\right) \end{equation*}

Member Typedef Documentation

template<int _Options>
typedef boost::shared_ptr<GenericTransformation> hpp::constraints::GenericTransformation< _Options >::Ptr_t
template<int _Options>
typedef boost::weak_ptr<GenericTransformation> hpp::constraints::GenericTransformation< _Options >::WkPtr_t

Member Enumeration Documentation

template<int _Options>
anonymous enum
Enumerator
IsRelative 
ComputeOrientation 
ComputePosition 
OutputSE3 
IsPosition 
IsOrientation 
IsTransform 
ValueSize 
DerSize 

Constructor & Destructor Documentation

template<int _Options>
virtual hpp::constraints::GenericTransformation< _Options >::~GenericTransformation ( )
inlinevirtual
template<int _Options>
hpp::constraints::GenericTransformation< _Options >::GenericTransformation ( const std::string &  name,
const DevicePtr_t robot,
std::vector< bool >  mask 
)

Constructor.

Parameters
namethe name of the constraints,
robotthe robot the constraints is applied to, \(T_1(\mathbf{q})^{-1} T_2(\mathbf{q})\) between the joints.
maskvector of 6 boolean defining which coordinates of the error vector to take into account.

Member Function Documentation

template<int _Options>
static Ptr_t hpp::constraints::GenericTransformation< _Options >::create ( const std::string &  name,
const DevicePtr_t robot,
const JointConstPtr_t joint2,
const Transform3f reference,
std::vector< bool >  mask = std::vector< bool >(DerSize, true) 
)
static

Object builder for absolute functions.

Parameters
namethe name of the constraints,
robotthe robot the constraints is applied to,
joint2the second joint the transformation of which is constrained,
referencedesired relative transformation \(T_2(\mathbf{q})\) between the joints.
maskwhich component of the error vector to take into account.
template<int _Options>
static Ptr_t hpp::constraints::GenericTransformation< _Options >::create ( const std::string &  name,
const DevicePtr_t robot,
const JointConstPtr_t joint2,
const Transform3f frame2,
const Transform3f frame1,
std::vector< bool >  mask = std::vector< bool >(DerSize, true) 
)
static

Object builder for absolute functions.

Parameters
namethe name of the constraints,
robotthe robot the constraints is applied to,
joint2the second joint the transformation of which is constrained,
frame2position of a fixed frame in joint 2,
frame1position of a fixed frame in the world,
maskvector of 6 boolean defining which coordinates of the error vector to take into account.
Note
For Position, the rotation part of frame1 defines the frame in which the error is expressed and the rotation of frame2 has no effect.
template<int _Options>
static Ptr_t hpp::constraints::GenericTransformation< _Options >::create ( const std::string &  name,
const DevicePtr_t robot,
const JointConstPtr_t joint1,
const JointConstPtr_t joint2,
const Transform3f reference,
std::vector< bool >  mask = std::vector< bool >(DerSize, true) 
)
static

Object builder for relative functions.

Parameters
namethe name of the constraints,
robotthe robot the constraints is applied to,
joint1the first joint the transformation of which is constrained,
joint2the second joint the transformation of which is constrained,
referencedesired relative transformation \(T_1(\mathbf{q})^{-1} T_2(\mathbf{q})\) between the joints.
maskwhich component of the error vector to take into account.
template<int _Options>
static Ptr_t hpp::constraints::GenericTransformation< _Options >::create ( const std::string &  name,
const DevicePtr_t robot,
const JointConstPtr_t joint1,
const JointConstPtr_t joint2,
const Transform3f frame1,
const Transform3f frame2,
std::vector< bool >  mask = std::vector< bool >(DerSize, true) 
)
static

Object builder for relative functions.

Parameters
namethe name of the constraints,
robotthe robot the constraints is applied to,
joint1the first joint the transformation of which is constrained,
joint2the second joint the transformation of which is constrained,
frame1position of a fixed frame in joint 1,
frame2position of a fixed frame in joint 2,
maskvector of 6 boolean defining which coordinates of the error vector to take into account.
Note
if joint1 is 0x0, joint 1 frame is considered to be the global frame.
For RelativePosition, the rotation part of frame1 defines the frame in which the error is expressed and the rotation of frame2 has no effect.
template<int _Options>
void hpp::constraints::GenericTransformation< _Options >::frame1InJoint1 ( const Transform3f M)
inline

Set position of frame 1 in joint 1.

template<int _Options>
const Transform3f& hpp::constraints::GenericTransformation< _Options >::frame1InJoint1 ( ) const
inline

Get position of frame 1 in joint 1.

template<int _Options>
void hpp::constraints::GenericTransformation< _Options >::frame2InJoint2 ( const Transform3f M)
inline

Set position of frame 2 in joint 2.

template<int _Options>
const Transform3f& hpp::constraints::GenericTransformation< _Options >::frame2InJoint2 ( ) const
inline

Get position of frame 2 in joint 2.

template<int _Options>
virtual void hpp::constraints::GenericTransformation< _Options >::impl_compute ( LiegroupElementRef  result,
ConfigurationIn_t  argument 
) const
throw (
)
protectedvirtual

Compute value of error.

Parameters
argumentconfiguration of the robot,
Return values
resulterror vector
template<int _Options>
virtual void hpp::constraints::GenericTransformation< _Options >::impl_jacobian ( matrixOut_t  jacobian,
ConfigurationIn_t  arg 
) const
throw (
)
protectedvirtual
template<int _Options>
void hpp::constraints::GenericTransformation< _Options >::init ( const WkPtr_t self)
inlineprotected
template<int _Options>
void hpp::constraints::GenericTransformation< _Options >::joint1 ( const JointConstPtr_t joint)
inline

Set joint 1.

References Eigen::assert().

template<int _Options>
JointConstPtr_t hpp::constraints::GenericTransformation< _Options >::joint1 ( ) const
inline

Get joint 1.

template<int _Options>
void hpp::constraints::GenericTransformation< _Options >::joint2 ( const JointConstPtr_t joint)
inline

Set joint 2.

References Eigen::assert().

template<int _Options>
JointConstPtr_t hpp::constraints::GenericTransformation< _Options >::joint2 ( ) const
inline

Get joint 2.

template<int _Options>
virtual std::ostream& hpp::constraints::GenericTransformation< _Options >::print ( std::ostream &  o) const
virtual

Display object in a stream.

Reimplemented from hpp::constraints::DifferentiableFunction.

template<int _Options>
void hpp::constraints::GenericTransformation< _Options >::reference ( const Transform3f reference)
inline

Set desired relative transformation of joint2 in joint1.

template<int _Options>
Transform3f hpp::constraints::GenericTransformation< _Options >::reference ( ) const
inline

Get desired relative orientation.