Main MRPT website > C++ reference for MRPT 1.5.9
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
mrpt::kinematics::CKinematicChain Class Reference

Detailed Description

A open-loop kinematic chain model, suitable to robotic manipulators.

Each link is parameterized with standard Denavit-Hartenberg standard parameterization [theta, d, a, alpha].

The orientation of the first link can be modified with setOriginPose(), which defaults to standard XYZ axes with +Z pointing upwards.

See also
CPose3D

Definition at line 54 of file CKinematicChain.h.

#include <mrpt/kinematics/CKinematicChain.h>

Inheritance diagram for mrpt::kinematics::CKinematicChain:
Inheritance graph

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) throw ()
 
void operator delete[] (void *ptr) throw ()
 
void operator delete (void *memory, void *ptr) throw ()
 
voidoperator new (size_t size, const std::nothrow_t &) throw ()
 
void operator delete (void *ptr, const std::nothrow_t &) throw ()
 
size_t size () const
 Return the number of links. More...
 
void clear ()
 Erases all links and leave the robot arm empty. More...
 
void addLink (double theta, double d, double a, double alpha, bool is_prismatic)
 Appends a new link to the robotic arm, with the given Denavit-Hartenberg parameters (see TKinematicLink for further details) More...
 
void removeLink (const size_t idx)
 Removes one link from the kinematic chain (0<=idx<N) More...
 
const TKinematicLinkgetLink (const size_t idx) const
 Get a ref to a given link (read-only) More...
 
TKinematicLinkgetLinkRef (const size_t idx)
 Get a ref to a given link (read-write) More...
 
void setOriginPose (const mrpt::poses::CPose3D &new_pose)
 Can be used to define a first degree of freedom along a +Z axis which does not coincide with the global +Z axis. More...
 
const mrpt::poses::CPose3DgetOriginPose () const
 Returns the current pose of the first link. More...
 
template<class VECTOR >
void getConfiguration (VECTOR &v) const
 Get all the DOFs of the arm at once, returning them in a vector with all the "q_i" values, which can be interpreted as rotations (radians) or displacements (meters) depending on links being "revolute" or "prismatic". More...
 
template<class VECTOR >
void setConfiguration (const VECTOR &v)
 Set all the DOFs of the arm at once, from a vector with all the "q_i" values, which are interpreted as rotations (radians) or displacements (meters) depending on links being "revolute" or "prismatic". More...
 
void getAs3DObject (mrpt::opengl::CSetOfObjectsPtr &inout_gl_obj, mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t *out_all_poses=NULL) const
 Constructs a 3D representation of the kinematic chain, in its current state. More...
 
void update3DObject (mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t *out_all_poses=NULL) const
 Read getAs3DObject() for a description. More...
 
void recomputeAllPoses (mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t &poses, const mrpt::poses::CPose3D &pose0=mrpt::poses::CPose3D()) const
 Go thru all the links of the chain and compute the global pose of each link. More...
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 
RTTI classes and functions
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Static Public Attributes

static const mrpt::utils::TRuntimeClassId classCObject
 
RTTI stuff
static const mrpt::utils::TRuntimeClassId classCSerializable
 

Protected Member Functions

CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version)
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. More...
 

Private Attributes

std::vector< mrpt::opengl::CRenderizablePtr > m_last_gl_objects
 Smart pointers to the last objects for each link, as returned in getAs3DObject(), for usage within update3DObject() More...
 
std::vector< TKinematicLinkm_links
 The links of this robot arm. More...
 
mrpt::poses::CPose3D m_origin
 The pose of the first link. More...
 

RTTI stuff

typedef CKinematicChainPtr Ptr
 
typedef CKinematicChainPtr ConstPtr
 
static mrpt::utils::CLASSINIT _init_CKinematicChain
 
static mrpt::utils::TRuntimeClassId classCKinematicChain
 
static const mrpt::utils::TRuntimeClassIdclassinfo
 
static const mrpt::utils::TRuntimeClassId_GetBaseClass ()
 
virtual const mrpt::utils::TRuntimeClassIdGetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CKinematicChainPtr Create ()
 

Member Typedef Documentation

◆ ConstPtr

typedef CKinematicChainPtr mrpt::kinematics::CKinematicChain::ConstPtr

Definition at line 57 of file CKinematicChain.h.

◆ Ptr

typedef CKinematicChainPtr mrpt::kinematics::CKinematicChain::Ptr

A typedef for the associated smart pointer

Definition at line 57 of file CKinematicChain.h.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::utils::TRuntimeClassId* mrpt::kinematics::CKinematicChain::_GetBaseClass ( )
staticprotected

◆ addLink()

void CKinematicChain::addLink ( double  theta,
double  d,
double  a,
double  alpha,
bool  is_prismatic 
)

Appends a new link to the robotic arm, with the given Denavit-Hartenberg parameters (see TKinematicLink for further details)

Definition at line 30 of file CKinematicChain.cpp.

◆ clear()

void CKinematicChain::clear ( )

Erases all links and leave the robot arm empty.

Definition at line 233 of file CKinematicChain.cpp.

◆ clone()

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 133 of file CObject.h.

◆ Create()

static CKinematicChainPtr mrpt::kinematics::CKinematicChain::Create ( )
static

◆ CreateObject()

static mrpt::utils::CObject* mrpt::kinematics::CKinematicChain::CreateObject ( )
static

◆ duplicate()

virtual mrpt::utils::CObject* mrpt::kinematics::CKinematicChain::duplicate ( ) const
virtual

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

◆ duplicateGetSmartPtr()

mrpt::utils::CObjectPtr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 162 of file CObject.h.

References mrpt::utils::CObjectPtr.

Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().

◆ getAs3DObject()

void CKinematicChain::getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &  inout_gl_obj,
mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t *  out_all_poses = NULL 
) const

Constructs a 3D representation of the kinematic chain, in its current state.

You can call update3DObject() to update the kinematic state of these OpenGL objects in the future, since an internal list of smart pointers to the constructed objects is kept internally. This is more efficient than calling this method again to build a new representation.

Parameters
[out]out_all_posesOptional output vector, will contain the poses in the format of recomputeAllPoses()
See also
update3DObject

Definition at line 163 of file CKinematicChain.cpp.

References addBar_A(), addBar_D(), ASSERT_, mrpt::opengl::stock_objects::CornerXYZSimple(), and mrpt::mrpt::format().

◆ getConfiguration()

template<class VECTOR >
void mrpt::kinematics::CKinematicChain::getConfiguration ( VECTOR &  v) const
inline

Get all the DOFs of the arm at once, returning them in a vector with all the "q_i" values, which can be interpreted as rotations (radians) or displacements (meters) depending on links being "revolute" or "prismatic".

The vector is automatically resized to the correct size (the number of links).

Template Parameters
VECTORCan be any Eigen vector, mrpt::math::CVectorDouble, or std::vector<double>

Definition at line 97 of file CKinematicChain.h.

◆ getLink()

const TKinematicLink & CKinematicChain::getLink ( const size_t  idx) const

Get a ref to a given link (read-only)

Definition at line 42 of file CKinematicChain.cpp.

References ASSERT_BELOW_.

◆ getLinkRef()

TKinematicLink & CKinematicChain::getLinkRef ( const size_t  idx)

Get a ref to a given link (read-write)

Definition at line 48 of file CKinematicChain.cpp.

References ASSERT_BELOW_.

◆ getOriginPose()

const mrpt::poses::CPose3D & CKinematicChain::getOriginPose ( ) const

Returns the current pose of the first link.

Definition at line 59 of file CKinematicChain.cpp.

◆ GetRuntimeClass()

virtual const mrpt::utils::TRuntimeClassId* mrpt::kinematics::CKinematicChain::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

◆ operator delete() [1/3]

void mrpt::kinematics::CKinematicChain::operator delete ( void ptr)
throw (
)
inline

Definition at line 57 of file CKinematicChain.h.

◆ operator delete() [2/3]

void mrpt::kinematics::CKinematicChain::operator delete ( void memory,
void ptr 
)
throw (
)
inline

Definition at line 57 of file CKinematicChain.h.

◆ operator delete() [3/3]

void mrpt::kinematics::CKinematicChain::operator delete ( void ptr,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 57 of file CKinematicChain.h.

◆ operator delete[]()

void mrpt::kinematics::CKinematicChain::operator delete[] ( void ptr)
throw (
)
inline

Definition at line 57 of file CKinematicChain.h.

◆ operator new() [1/3]

void* mrpt::kinematics::CKinematicChain::operator new ( size_t  size)
inline

Definition at line 57 of file CKinematicChain.h.

◆ operator new() [2/3]

static void* mrpt::kinematics::CKinematicChain::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 57 of file CKinematicChain.h.

◆ operator new() [3/3]

void* mrpt::kinematics::CKinematicChain::operator new ( size_t  size,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 57 of file CKinematicChain.h.

◆ operator new[]()

void* mrpt::kinematics::CKinematicChain::operator new[] ( size_t  size)
inline

Definition at line 57 of file CKinematicChain.h.

◆ readFromStream()

void CKinematicChain::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protectedvirtual

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any error, see CStream::ReadBuffer
See also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 80 of file CKinematicChain.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, and version.

◆ recomputeAllPoses()

void CKinematicChain::recomputeAllPoses ( mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t &  poses,
const mrpt::poses::CPose3D pose0 = mrpt::poses::CPose3D() 
) const

Go thru all the links of the chain and compute the global pose of each link.

The "ground" link pose "pose0" defaults to the origin of coordinates, but anything else can be passed as the optional argument. The returned vector has N+1 elements (N=number of links), since [0] contains the base frame, [1] the pose after the first link, and so on.

The "ground" link pose "pose0" defaults to the origin of coordinates, but anything else can be passed as the optional argument.

Definition at line 101 of file CKinematicChain.cpp.

References MRPT_UNUSED_PARAM, and R.

◆ removeLink()

void CKinematicChain::removeLink ( const size_t  idx)

Removes one link from the kinematic chain (0<=idx<N)

Definition at line 36 of file CKinematicChain.cpp.

References ASSERT_BELOW_.

◆ setConfiguration()

template<class VECTOR >
void mrpt::kinematics::CKinematicChain::setConfiguration ( const VECTOR &  v)
inline

Set all the DOFs of the arm at once, from a vector with all the "q_i" values, which are interpreted as rotations (radians) or displacements (meters) depending on links being "revolute" or "prismatic".

Exceptions
std::exceptionIf the size of the vector doesn't match the number of links.
Template Parameters
VECTORCan be any Eigen vector, mrpt::math::CVectorDouble, or std::vector<double>

Definition at line 114 of file CKinematicChain.h.

References ASSERT_EQUAL_.

◆ setOriginPose()

void CKinematicChain::setOriginPose ( const mrpt::poses::CPose3D new_pose)

Can be used to define a first degree of freedom along a +Z axis which does not coincide with the global +Z axis.

Definition at line 54 of file CKinematicChain.cpp.

◆ size()

size_t mrpt::kinematics::CKinematicChain::size ( ) const
inline

Return the number of links.

Definition at line 68 of file CKinematicChain.h.

◆ update3DObject()

void CKinematicChain::update3DObject ( mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t *  out_all_poses = NULL) const

Read getAs3DObject() for a description.

Parameters
[out]out_all_posesOptional output vector, will contain the poses in the format of recomputeAllPoses()

Definition at line 197 of file CKinematicChain.cpp.

References ASSERTMSG_.

◆ writeToMatlab()

virtual mxArray* mrpt::utils::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or NULL is class does not support conversion to MATLAB.

Definition at line 79 of file CSerializable.h.

◆ writeToStream()

void CKinematicChain::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
protectedvirtual

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions
std::exceptionOn any error, see CStream::WriteBuffer
See also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 67 of file CKinematicChain.cpp.

References version.

Member Data Documentation

◆ _init_CKinematicChain

mrpt::utils::CLASSINIT mrpt::kinematics::CKinematicChain::_init_CKinematicChain
staticprotected

Definition at line 57 of file CKinematicChain.h.

◆ classCKinematicChain

mrpt::utils::TRuntimeClassId mrpt::kinematics::CKinematicChain::classCKinematicChain
static

Definition at line 57 of file CKinematicChain.h.

◆ classCObject

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 118 of file CObject.h.

◆ classCSerializable

const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable
staticinherited

Definition at line 42 of file CSerializable.h.

◆ classinfo

const mrpt::utils::TRuntimeClassId* mrpt::kinematics::CKinematicChain::classinfo
static

Definition at line 57 of file CKinematicChain.h.

◆ m_last_gl_objects

std::vector<mrpt::opengl::CRenderizablePtr> mrpt::kinematics::CKinematicChain::m_last_gl_objects
mutableprivate

Smart pointers to the last objects for each link, as returned in getAs3DObject(), for usage within update3DObject()

Definition at line 60 of file CKinematicChain.h.

◆ m_links

std::vector<TKinematicLink> mrpt::kinematics::CKinematicChain::m_links
private

The links of this robot arm.

Definition at line 62 of file CKinematicChain.h.

◆ m_origin

mrpt::poses::CPose3D mrpt::kinematics::CKinematicChain::m_origin
private

The pose of the first link.

Definition at line 63 of file CKinematicChain.h.




Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020