MRPT  1.9.9
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 70 of file CKinematicChain.h.

#include <mrpt/kinematics/CKinematicChain.h>

Inheritance diagram for mrpt::kinematics::CKinematicChain:

Public Member Functions

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::CSetOfObjects::Ptr &inout_gl_obj, std::vector< mrpt::poses::CPose3D > *out_all_poses=nullptr) const
 Constructs a 3D representation of the kinematic chain, in its current state. More...
 
void update3DObject (std::vector< mrpt::poses::CPose3D > *out_all_poses=nullptr) const
 Read getAs3DObject() for a description. More...
 
void recomputeAllPoses (std::vector< mrpt::poses::CPose3D > &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...
 
RTTI classes and functions for polymorphic hierarchies
mrpt::rtti::CObject::Ptr duplicateGetSmartPtr () const
 Makes a deep copy of the object and returns a smart pointer to it. More...
 

Protected Member Functions

CSerializable virtual methods
uint8_t serializeGetVersion () const override
 Must return the current versioning number of the object. More...
 
void serializeTo (mrpt::serialization::CArchive &out) const override
 Pure virtual method for writing (serializing) to an abstract archive. More...
 
void serializeFrom (mrpt::serialization::CArchive &in, uint8_t serial_version) override
 Pure virtual method for reading (deserializing) from an abstract archive. More...
 
CSerializable virtual methods
virtual void serializeTo (CSchemeArchiveBase &out) const
 Virtual method for writing (serializing) to an abstract schema based archive. More...
 
virtual void serializeFrom (CSchemeArchiveBase &in)
 Virtual method for reading (deserializing) from an abstract schema based archive. More...
 

Private Attributes

std::vector< mrpt::opengl::CRenderizable::Ptrm_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

using Ptr = std::shared_ptr< CKinematicChain >
 
using ConstPtr = std::shared_ptr< const CKinematicChain >
 
using UniquePtr = std::unique_ptr< CKinematicChain >
 
using ConstUniquePtr = std::unique_ptr< const CKinematicChain >
 
static mrpt::rtti::CLASSINIT _init_CKinematicChain
 
static const mrpt::rtti::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "CKinematicChain"
 
static const mrpt::rtti::TRuntimeClassId_GetBaseClass ()
 
static constexpr auto getClassName ()
 
static const mrpt::rtti::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static std::shared_ptr< CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
template<typename Alloc , typename... Args>
static Ptr CreateAlloc (const Alloc &alloc, Args &&... args)
 
template<typename... Args>
static UniquePtr CreateUnique (Args &&... args)
 
virtual const mrpt::rtti::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::rtti::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Member Typedef Documentation

◆ ConstPtr

◆ ConstUniquePtr

Definition at line 72 of file CKinematicChain.h.

◆ Ptr

A type for the associated smart pointer

Definition at line 72 of file CKinematicChain.h.

◆ UniquePtr

Definition at line 72 of file CKinematicChain.h.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::rtti::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 29 of file CKinematicChain.cpp.

◆ clear()

void CKinematicChain::clear ( )

Erases all links and leave the robot arm empty.

Definition at line 239 of file CKinematicChain.cpp.

◆ clone()

virtual mrpt::rtti::CObject* mrpt::kinematics::CKinematicChain::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::rtti::CObject.

◆ Create()

template<typename... Args>
static Ptr mrpt::kinematics::CKinematicChain::Create ( Args &&...  args)
inlinestatic

Definition at line 72 of file CKinematicChain.h.

◆ CreateAlloc()

template<typename Alloc , typename... Args>
static Ptr mrpt::kinematics::CKinematicChain::CreateAlloc ( const Alloc &  alloc,
Args &&...  args 
)
inlinestatic

Definition at line 72 of file CKinematicChain.h.

◆ CreateObject()

static std::shared_ptr<CObject> mrpt::kinematics::CKinematicChain::CreateObject ( )
static

◆ CreateUnique()

template<typename... Args>
static UniquePtr mrpt::kinematics::CKinematicChain::CreateUnique ( Args &&...  args)
inlinestatic

Definition at line 72 of file CKinematicChain.h.

◆ duplicateGetSmartPtr()

mrpt::rtti::CObject::Ptr CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Makes a deep copy of the object and returns a smart pointer to it.

Definition at line 200 of file CObject.h.

References mrpt::rtti::CObject::clone().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAs3DObject()

void CKinematicChain::getAs3DObject ( mrpt::opengl::CSetOfObjects::Ptr inout_gl_obj,
std::vector< mrpt::poses::CPose3D > *  out_all_poses = nullptr 
) 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 161 of file CKinematicChain.cpp.

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

Here is the call graph for this function:

◆ getClassName()

static constexpr auto mrpt::kinematics::CKinematicChain::getClassName ( )
inlinestatic

Definition at line 72 of file CKinematicChain.h.

◆ 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 121 of file CKinematicChain.h.

References m_links.

◆ 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::rtti::TRuntimeClassId* mrpt::kinematics::CKinematicChain::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::serialization::CSerializable.

◆ GetRuntimeClassIdStatic()

static const mrpt::rtti::TRuntimeClassId& mrpt::kinematics::CKinematicChain::GetRuntimeClassIdStatic ( )
static

◆ recomputeAllPoses()

void CKinematicChain::recomputeAllPoses ( std::vector< mrpt::poses::CPose3D > &  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 95 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_.

◆ serializeFrom() [1/2]

void CKinematicChain::serializeFrom ( mrpt::serialization::CArchive in,
uint8_t  serial_version 
)
overrideprotectedvirtual

Pure virtual method for reading (deserializing) from an abstract archive.

Users don't call this method directly. Instead, use stream >> object;.

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 I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 70 of file CKinematicChain.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

◆ serializeFrom() [2/2]

virtual void mrpt::serialization::CSerializable::serializeFrom ( CSchemeArchiveBase in)
inlineprotectedvirtualinherited

Virtual method for reading (deserializing) from an abstract schema based archive.

Definition at line 74 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ serializeGetVersion()

uint8_t CKinematicChain::serializeGetVersion ( ) const
overrideprotectedvirtual

Must return the current versioning number of the object.

Start in zero for new classes, and increments each time there is a change in the stored format.

Implements mrpt::serialization::CSerializable.

Definition at line 64 of file CKinematicChain.cpp.

◆ serializeTo() [1/2]

virtual void mrpt::serialization::CSerializable::serializeTo ( CSchemeArchiveBase out) const
inlineprotectedvirtualinherited

Virtual method for writing (serializing) to an abstract schema based archive.

Definition at line 64 of file CSerializable.h.

References mrpt::serialization::CSerializable::GetRuntimeClass(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ serializeTo() [2/2]

void CKinematicChain::serializeTo ( mrpt::serialization::CArchive out) const
overrideprotectedvirtual

Pure virtual method for writing (serializing) to an abstract archive.

Users don't call this method directly. Instead, use stream << object;.

Exceptions
std::exceptionOn any I/O error

Implements mrpt::serialization::CSerializable.

Definition at line 65 of file CKinematicChain.cpp.

◆ 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 144 of file CKinematicChain.h.

References ASSERT_EQUAL_, m_links, and size().

Here is the call graph for this function:

◆ 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 86 of file CKinematicChain.h.

References m_links.

Referenced by setConfiguration().

Here is the caller graph for this function:

◆ update3DObject()

void CKinematicChain::update3DObject ( std::vector< mrpt::poses::CPose3D > *  out_all_poses = nullptr) 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 194 of file CKinematicChain.cpp.

References ASSERTMSG_.

◆ writeToMatlab()

virtual mxArray* mrpt::serialization::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 nullptr is class does not support conversion to MATLAB.

Definition at line 90 of file CSerializable.h.

Member Data Documentation

◆ _init_CKinematicChain

mrpt::rtti::CLASSINIT mrpt::kinematics::CKinematicChain::_init_CKinematicChain
staticprotected

Definition at line 72 of file CKinematicChain.h.

◆ className

constexpr const char* mrpt::kinematics::CKinematicChain::className = "CKinematicChain"
static

Definition at line 72 of file CKinematicChain.h.

◆ m_last_gl_objects

std::vector<mrpt::opengl::CRenderizable::Ptr> 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 77 of file CKinematicChain.h.

◆ m_links

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

The links of this robot arm.

Definition at line 80 of file CKinematicChain.h.

Referenced by getConfiguration(), setConfiguration(), and size().

◆ m_origin

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

The pose of the first link.

Definition at line 82 of file CKinematicChain.h.

◆ runtimeClassId

const mrpt::rtti::TRuntimeClassId mrpt::kinematics::CKinematicChain::runtimeClassId
staticprotected

Definition at line 72 of file CKinematicChain.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019