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.
Definition at line 70 of file CKinematicChain.h.
#include <mrpt/kinematics/CKinematicChain.h>
Public Member Functions | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) noexcept |
void | operator delete[] (void *ptr) noexcept |
void | operator delete (void *memory, void *ptr) noexcept |
void * | operator new (size_t size, const std::nothrow_t &) noexcept |
void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
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 TKinematicLink & | getLink (const size_t idx) const |
Get a ref to a given link (read-only) More... | |
TKinematicLink & | getLinkRef (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::CPose3D & | getOriginPose () 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, mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t *out_all_poses=nullptr) 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=nullptr) 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 mxArray * | writeToMatlab () 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 | |
mrpt::utils::CObject::Ptr | 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 void * | operator new (size_t size, void *ptr) |
Protected Member Functions | |
CSerializable virtual methods | |
void | writeToStream (mrpt::utils::CStream &out, int *getVersion) const override |
Introduces a pure virtual method responsible for writing to a CStream. More... | |
void | readFromStream (mrpt::utils::CStream &in, int version) override |
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::CRenderizable::Ptr > | m_last_gl_objects |
Smart pointers to the last objects for each link, as returned in getAs3DObject(), for usage within update3DObject() More... | |
std::vector< TKinematicLink > | m_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 > |
static mrpt::utils::CLASSINIT | _init_CKinematicChain |
static const mrpt::utils::TRuntimeClassId | runtimeClassId |
static constexpr const char * | className = "CKinematicChain" |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
static const mrpt::utils::TRuntimeClassId & | GetRuntimeClassIdStatic () |
static mrpt::utils::CObject * | CreateObject () |
template<typename... Args> | |
static Ptr | Create (Args &&... args) |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const override |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::utils::CObject * | clone () const override |
Returns a deep copy (clone) of the object, indepently of its class. More... | |
using mrpt::kinematics::CKinematicChain::ConstPtr = std::shared_ptr<const CKinematicChain > |
Definition at line 72 of file CKinematicChain.h.
using mrpt::kinematics::CKinematicChain::Ptr = std::shared_ptr< CKinematicChain > |
A typedef for the associated smart pointer
Definition at line 72 of file CKinematicChain.h.
|
staticprotected |
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.
void CKinematicChain::clear | ( | ) |
Erases all links and leave the robot arm empty.
Definition at line 252 of file CKinematicChain.cpp.
|
overridevirtual |
Returns a deep copy (clone) of the object, indepently of its class.
Implements mrpt::utils::CObject.
|
inlinestatic |
Definition at line 72 of file CKinematicChain.h.
|
static |
void CKinematicChain::getAs3DObject | ( | mrpt::opengl::CSetOfObjects::Ptr & | inout_gl_obj, |
mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t * | 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.
[out] | out_all_poses | Optional output vector, will contain the poses in the format of recomputeAllPoses() |
Definition at line 172 of file CKinematicChain.cpp.
References addBar_A(), addBar_D(), ASSERT_, mrpt::opengl::stock_objects::CornerXYZSimple(), and mrpt::mrpt::format().
|
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).
VECTOR | Can be any Eigen vector, mrpt::math::CVectorDouble, or std::vector<double> |
Definition at line 121 of file CKinematicChain.h.
References m_links.
const TKinematicLink & CKinematicChain::getLink | ( | const size_t | idx | ) | const |
Get a ref to a given link (read-only)
Definition at line 43 of file CKinematicChain.cpp.
References ASSERT_BELOW_.
TKinematicLink & CKinematicChain::getLinkRef | ( | const size_t | idx | ) |
Get a ref to a given link (read-write)
Definition at line 49 of file CKinematicChain.cpp.
References ASSERT_BELOW_.
const mrpt::poses::CPose3D & CKinematicChain::getOriginPose | ( | ) | const |
Returns the current pose of the first link.
Definition at line 60 of file CKinematicChain.cpp.
|
overridevirtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
|
static |
Definition at line 72 of file CKinematicChain.h.
|
inlinenoexcept |
Definition at line 72 of file CKinematicChain.h.
|
inlinenoexcept |
Definition at line 72 of file CKinematicChain.h.
Definition at line 72 of file CKinematicChain.h.
|
inlinestatic |
Definition at line 72 of file CKinematicChain.h.
|
inlinenoexcept |
Definition at line 72 of file CKinematicChain.h.
|
inline |
Definition at line 72 of file CKinematicChain.h.
|
inline |
Definition at line 72 of file CKinematicChain.h.
|
overrideprotectedvirtual |
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.
in | The input binary stream where the object data must read from. |
version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
std::exception | On any error, see CStream::ReadBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 82 of file CKinematicChain.cpp.
References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.
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 106 of file CKinematicChain.cpp.
References MRPT_UNUSED_PARAM, and R.
void CKinematicChain::removeLink | ( | const size_t | idx | ) |
Removes one link from the kinematic chain (0<=idx<N)
Definition at line 37 of file CKinematicChain.cpp.
References ASSERT_BELOW_.
|
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".
std::exception | If the size of the vector doesn't match the number of links. |
VECTOR | Can 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().
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 55 of file CKinematicChain.cpp.
|
inline |
Return the number of links.
Definition at line 86 of file CKinematicChain.h.
References m_links.
Referenced by setConfiguration().
void CKinematicChain::update3DObject | ( | mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t * | out_all_poses = nullptr | ) | const |
Read getAs3DObject() for a description.
[out] | out_all_poses | Optional output vector, will contain the poses in the format of recomputeAllPoses() |
Definition at line 206 of file CKinematicChain.cpp.
References ASSERTMSG_, mrpt::opengl::CCylinder::setHeight(), and mrpt::opengl::CRenderizable::setPose().
|
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.
mxArray
(caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB. Definition at line 89 of file CSerializable.h.
|
overrideprotectedvirtual |
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.
out | The output binary stream where object must be dumped. |
getVersion | If nullptr, 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. |
std::exception | On any error, see CStream::WriteBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 68 of file CKinematicChain.cpp.
|
staticprotected |
Definition at line 72 of file CKinematicChain.h.
|
static |
Definition at line 72 of file CKinematicChain.h.
|
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.
|
private |
The links of this robot arm.
Definition at line 80 of file CKinematicChain.h.
Referenced by getConfiguration(), setConfiguration(), and size().
|
private |
The pose of the first link.
Definition at line 82 of file CKinematicChain.h.
|
staticprotected |
Definition at line 72 of file CKinematicChain.h.
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019 |