9 #ifndef mrpt_CKinematicChain_H
10 #define mrpt_CKinematicChain_H
39 TKinematicLink(
double _theta,
double _d,
double _a,
double _alpha,
bool _is_prismatic) : theta(_theta),d(_d),a(_a),alpha(_alpha),is_prismatic(_is_prismatic) {}
68 size_t size()
const {
return m_links.size(); }
74 void addLink(
double theta,
double d,
double a,
double alpha,
bool is_prismatic);
96 template <
class VECTOR>
99 const size_t N=m_links.size();
101 for (
size_t i=0;i<N;i++) {
102 if (m_links[i].is_prismatic)
104 else v[i] = m_links[i].theta;
113 template <
class VECTOR>
117 const size_t N=m_links.size();
118 for (
size_t i=0;i<N;i++) {
119 if (m_links[i].is_prismatic)
121 else m_links[i].theta = v[i];
133 mrpt::opengl::CSetOfObjectsPtr &inout_gl_obj,
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
#define MRPT_DECLARE_TTYPENAME_NAMESPACE(_TYPE, __NS)
A open-loop kinematic chain model, suitable to robotic manipulators.
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 TKinematicLi...
mrpt::poses::CPose3D m_origin
The pose of the first link.
const mrpt::poses::CPose3D & getOriginPose() const
Returns the current pose of the first link.
const TKinematicLink & getLink(const size_t idx) const
Get a ref to a given link (read-only)
size_t size() const
Return the number of links.
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.
void clear()
Erases all links and leave the robot arm empty.
void removeLink(const size_t idx)
Removes one link from the kinematic chain (0<=idx<N)
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 glob...
TKinematicLink & getLinkRef(const size_t idx)
Get a ref to a given link (read-write)
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.
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 a...
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,...
void update3DObject(mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t *out_all_poses=NULL) const
Read getAs3DObject() for a description.
std::vector< TKinematicLink > m_links
The links of this robot arm.
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 up...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
The virtual base class which provides a unified interface for all persistent objects in MRPT.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define KINEMATICS_IMPEXP
#define ASSERT_EQUAL_(__A, __B)
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CKinematicChainPtr &pObj)
KINEMATICS_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const TKinematicLink &o)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t
An individual kinematic chain element (one link) which builds up a CKinematicChain.
TKinematicLink(double _theta, double _d, double _a, double _alpha, bool _is_prismatic)
double alpha
Rotation along X_{i+1} to transform Z_i into Z_{i+1}.
double d
Distance along Z_i to the common normal between Z_i and Z_{i+1}.
double a
Distance along the common normal (in the same direction than the new X_{i+1})
double theta
Rotation from X_i to X_{i+1} (radians)
bool is_prismatic
"false": Is revolute ("q_i" is "theta"), "true": is prismatic ("q_i" is "d")