|
Biorbd Release_1.13.0
|
Description of a segment. More...
#include <Segment.h>
Public Member Functions | |
| Segment () | |
| Construct a Segment. | |
| Segment (rigidbody::Joints &model, const utils::String &name, const utils::String &parentName, const utils::String &seqT, const utils::String &seqR, const std::vector< utils::Range > &QRanges, const std::vector< utils::Range > &QdotRanges, const std::vector< utils::Range > &QddotRanges, const std::vector< utils::Scalar > &jointDamping, const SegmentCharacteristics &characteristics, const utils::SpatialTransform &cor) | |
| Construct a Segment. | |
| Segment (rigidbody::Joints &model, const utils::String &name, const utils::String &parentName, const utils::String &seqR, const std::vector< utils::Range > &QRanges, const std::vector< utils::Range > &QdotRanges, const std::vector< utils::Range > &QddotRanges, const std::vector< utils::Scalar > &jointDamping, const SegmentCharacteristics &characteristics, const utils::SpatialTransform &cor) | |
| Construct a Segment. | |
| Segment | DeepCopy () const |
| Create a deep copy of Segment. | |
| void | DeepCopy (const Segment &other) |
| Deep copy of Segment. | |
| virtual | ~Segment () |
| Destroy the class properly. | |
| size_t | id () const |
| Return the Segment index. | |
| const utils::String & | seqT () const |
| Return the translation sequence in text. | |
| const utils::String & | seqR () const |
| Return the angle sequence in text. | |
| const std::vector< utils::Range > & | QRanges () const |
| Return the ranges for all the dof, translations and rotations respectively. | |
| void | setQRanges (const std::vector< utils::Range > &QRanges) |
| Set the ranges for all the dof, translations and rotations respectively. | |
| const std::vector< utils::Range > & | QdotRanges () const |
| Return the ranges for all the dof velocity, translations and rotations respectively. | |
| void | setQdotRanges (const std::vector< utils::Range > &QdotRanges) |
| Set the ranges for all the dof velocity, translations and rotations respectively. | |
| const std::vector< utils::Range > & | QddotRanges () const |
| Return the ranges for all the dof acceleration, translations and rotations respectively. | |
| void | setQddotRanges (const std::vector< utils::Range > &QddotRanges) |
| Set the ranges for all the dof acceleration, translations and rotations respectively. | |
| const std::vector< utils::Scalar > & | jointDampings () const |
| Return the joint damping to apply to the dynamics. | |
| void | setJointDampings (const std::vector< utils::Scalar > &jointDampings) |
| Set the joint damping to apply to the dynamics. | |
| size_t | nbDof () const |
| Return the number of DoF of the segment. | |
| size_t | nbDofTrans () const |
| Return the number of translation DoF of the segment. | |
| size_t | nbDofRot () const |
| Return the number of rotation DoF of the segment. | |
| size_t | nbQ () const |
| Return the number of generalized coordinates. | |
| size_t | nbQdot () const |
| Return the number of generalized velocities. | |
| size_t | nbQddot () const |
| Return the number of generalized accelerations. | |
| size_t | nbGeneralizedTorque () const |
| Return the number of generalized torque. | |
| size_t | getDofIdx (const utils::String &dofName) const |
| Return the index of a specified DoF. | |
| const rigidbody::Segment & | findFirstSegmentWithDof (const rigidbody::Joints &model) const |
| Traverse the model hierarchy until it gets to a segment with a dof. If the current segment has at least one dof, the current segment is returned. | |
| size_t | getFirstDofIndexInGeneralizedCoordinates (const rigidbody::Joints &model) const |
| Returns the first index of the segment in the Generalized Coordinates vector. | |
| size_t | getLastDofIndexInGeneralizedCoordinates (const rigidbody::Joints &model) const |
| Returns the last index of the segment in the Generalized Coordinates vector. | |
| const utils::String & | nameDof (const size_t i) const |
| Return the name of the specified DoF. | |
| utils::RotoTrans | localJCS () const |
| Return the joint coordinate system (JCS) in the parent reference frame. | |
| void | setLocalJCS (rigidbody::Joints &model, utils::RotoTrans &rototrans) |
| set the joint coordinate system (JCS) in the parent reference frame | |
| void | updateCharacteristics (rigidbody::Joints &model, const SegmentCharacteristics &characteristics) |
| updateCharacteristics Change the inertia characteristics of the segment | |
| SegmentCharacteristics & | characteristics () |
| Return the segment characteristics. | |
| const SegmentCharacteristics & | characteristics () const |
| Return the segment characteristics. | |
| bool | isRotationAQuaternion () const |
| Return if the rotation DoF of this segment is a quaternion. | |
| Public Member Functions inherited from BIORBD_NAMESPACE::utils::Node | |
| Node () | |
| Construct Node. | |
| Node (const Node &other) | |
| Construct Node from another node. | |
| Node (const String &name) | |
| Construct Node. | |
| Node (const String &name, const String &parentName) | |
| Construct Node. | |
| virtual | ~Node () |
| Destroy class properly. | |
| void | DeepCopy (const Node &other) |
| Deep copy of the node in another node. | |
| void | setName (const String &name) |
| Set the name of the node. | |
| const String & | name () const |
| Return the name of the node. | |
| const String & | parent () const |
| Return the parent name of the node. | |
| void | setParent (const String &name) |
| Set the parent name of the node. | |
| NODE_TYPE | typeOfNode () const |
| Return the type of node. | |
Protected Member Functions | |
| void | setType () |
| Set the type of the segment. | |
| void | setDofs (rigidbody::Joints &model, const utils::String &seqT, const utils::String &seqR, const std::vector< utils::Range > &QRanges, const std::vector< utils::Range > &QdotRanges, const std::vector< utils::Range > &QddotRanges, const std::vector< utils::Scalar > &jointDamping) |
| Set the DoF. | |
| template<typename T> | |
| bool | isVectorHasDofDimension (const std::vector< T > &vec, bool isQLevel) const |
| Check if the vector has the same number of elements as the number of DoF. | |
| void | setNumberOfDof (size_t nbTrans, size_t nbRot) |
| Set the total number of DoF. | |
| void | determineIfRotIsQuaternion (const utils::String &seqR) |
| Determines if DoF in rotation is a Quaternion. | |
| void | setSequence (const utils::String &seqT, const utils::String &seqR) |
| Set angle and translation sequences, adjust angle sequence and redeclare if is necessary. | |
| void | fillSequence () |
| Fill the transation and rotation sequences. | |
| void | str2numSequence (std::vector< size_t > &sequenceInteger, const utils::String &sequenceText) |
| Convert a text sequence to its number counterpart (x = 0, y = 1, z = 2, q = 3). | |
| void | str2numSequence (const utils::String &seqT, const utils::String &seqR) |
| Store the sequences. | |
| virtual void | setJoints (rigidbody::Joints &model) |
| Function that adds the segment to the RBDL body set. | |
| virtual void | setJointAxis () |
| Determine the rotation axis in relation to the requested sequence. | |
| void | setDofCharacteristicsOnLastBody () |
| Set the DoF segment characteristics on the last body. | |
Protected Attributes | |
| std::shared_ptr< int > | m_idxInModel |
| Index in RBDL model. | |
| std::shared_ptr< utils::SpatialTransform > | m_cor |
| Attitude of the segment in parent reference frame. | |
| std::shared_ptr< utils::String > | m_seqT |
| Translation sequence. | |
| std::shared_ptr< utils::String > | m_seqR |
| Euler rotation sequence. | |
| std::shared_ptr< size_t > | m_nbDof |
| Number of degrees of freedom. | |
| std::shared_ptr< size_t > | m_nbQdot |
| Number of generalized velocities. | |
| std::shared_ptr< size_t > | m_nbQddot |
| Number of generalized accelerations. | |
| std::shared_ptr< size_t > | m_nbDofTrue |
| std::shared_ptr< size_t > | m_nbDofTrueOutside |
| std::shared_ptr< size_t > | m_nbDofTrans |
| Number of degrees of freedom in translation. | |
| std::shared_ptr< size_t > | m_nbDofRot |
| Number of degrees of freedom in rotation. | |
| std::shared_ptr< size_t > | m_nbDofQuat |
| std::shared_ptr< std::vector< utils::Range > > | m_QRanges |
| std::shared_ptr< std::vector< utils::Range > > | m_QdotRanges |
| std::shared_ptr< std::vector< utils::Range > > | m_QddotRanges |
| std::shared_ptr< std::vector< utils::Scalar > > | m_jointDampings |
| The joint dampings to apply to the dynamics. | |
| std::shared_ptr< bool > | m_isQuaternion |
| If DoF in rotation is a Quaternion. | |
| std::shared_ptr< std::vector< RigidBodyDynamics::Joint > > | m_dof |
| std::shared_ptr< std::vector< size_t > > | m_idxDof |
| Index of the parent segment. | |
| std::shared_ptr< std::vector< size_t > > | m_sequenceTrans |
| Translation sequence. | |
| std::shared_ptr< std::vector< size_t > > | m_sequenceRot |
| Euler rotation sequence. | |
| std::shared_ptr< std::vector< utils::String > > | m_nameDof |
| To store the DoF names. | |
| std::shared_ptr< std::vector< size_t > > | m_dofPosition |
| Position in the x, y, and z sequence. | |
| std::shared_ptr< SegmentCharacteristics > | m_characteristics |
| std::shared_ptr< std::vector< SegmentCharacteristics > > | m_dofCharacteristics |
| Protected Attributes inherited from BIORBD_NAMESPACE::utils::Node | |
| std::shared_ptr< String > | m_name |
| The name of the node. | |
| std::shared_ptr< String > | m_parentName |
| The parent name of the node. | |
| std::shared_ptr< NODE_TYPE > | m_typeOfNode |
| The type of the node. | |
| rigidbody::Segment::Segment | ( | ) |
Construct a Segment.
Definition at line 20 of file Segment.cpp.
| rigidbody::Segment::Segment | ( | rigidbody::Joints & | model, |
| const utils::String & | name, | ||
| const utils::String & | parentName, | ||
| const utils::String & | seqT, | ||
| const utils::String & | seqR, | ||
| const std::vector< utils::Range > & | QRanges, | ||
| const std::vector< utils::Range > & | QdotRanges, | ||
| const std::vector< utils::Range > & | QddotRanges, | ||
| const std::vector< utils::Scalar > & | jointDamping, | ||
| const SegmentCharacteristics & | characteristics, | ||
| const utils::SpatialTransform & | cor ) |
Construct a Segment.
| model | The joint model |
| name | The name of the segment |
| parentName | The name of the parent segment |
| seqT | Sequence of the translations |
| seqR | Angle sequence of the Euler rotations |
| QRanges | Ranges of the translations and rotations dof. The length of QRanges must be equal to length of translations and rotations |
| QdotRanges | Ranges of the translations and rotations dof velocity. The length of QdotRanges must be equal to length of translations and rotations |
| QddotRanges | Ranges of the translations and rotations dof acceleration. The length of QddotRanges must be equal to length of translations and rotations |
| jointDamping | The joint damping to apply to the dynamics |
| characteristics | of the segment (mass, center of mass, inertia, etc.) |
| cor | Transformation in parent reference frame |
Definition at line 51 of file Segment.cpp.
| rigidbody::Segment::Segment | ( | rigidbody::Joints & | model, |
| const utils::String & | name, | ||
| const utils::String & | parentName, | ||
| const utils::String & | seqR, | ||
| const std::vector< utils::Range > & | QRanges, | ||
| const std::vector< utils::Range > & | QdotRanges, | ||
| const std::vector< utils::Range > & | QddotRanges, | ||
| const std::vector< utils::Scalar > & | jointDamping, | ||
| const SegmentCharacteristics & | characteristics, | ||
| const utils::SpatialTransform & | cor ) |
Construct a Segment.
| model | The joint model |
| name | The name of the segment |
| parentName | The name of the parent segment |
| seqR | Angle sequence of the Euler rotations |
| QRanges | Ranges of the translations and rotations dof. The length of QRanges must be equal to length of translations and rotations |
| QdotRanges | Ranges of the translations and rotations dof velocity. The length of QdotRanges must be equal to length of translations and rotations |
| QddotRanges | Ranges of the translations and rotations dof acceleration. The length of QddotRanges must be equal to length of translations and rotations |
| jointDamping | The joint damping to apply to the dynamics |
| characteristics | of the segment (mass, center of mass, inertia, etc.) |
| cor | Transformation in parent reference frame |
Definition at line 95 of file Segment.cpp.
|
virtual |
Destroy the class properly.
Definition at line 186 of file Segment.cpp.
| rigidbody::SegmentCharacteristics & rigidbody::Segment::characteristics | ( | ) |
Return the segment characteristics.
Definition at line 304 of file Segment.cpp.
| const rigidbody::SegmentCharacteristics & rigidbody::Segment::characteristics | ( | ) | const |
Return the segment characteristics.
Definition at line 308 of file Segment.cpp.
| rigidbody::Segment rigidbody::Segment::DeepCopy | ( | ) | const |
| void rigidbody::Segment::DeepCopy | ( | const Segment & | other | ) |
Deep copy of Segment.
| other | The Segment to copy |
Definition at line 148 of file Segment.cpp.
|
protected |
Determines if DoF in rotation is a Quaternion.
| seqR | Cardan sequence to classify the DoF in rotation |
If seqR is equal to "q" then it is a quaternion
Definition at line 348 of file Segment.cpp.
|
protected |
Fill the transation and rotation sequences.
Places the translations first, followed by the rotations in the asked order.
Definition at line 433 of file Segment.cpp.
| const rigidbody::Segment & rigidbody::Segment::findFirstSegmentWithDof | ( | const rigidbody::Joints & | model | ) | const |
Traverse the model hierarchy until it gets to a segment with a dof. If the current segment has at least one dof, the current segment is returned.
| model | The joint model |
Definition at line 568 of file Segment.cpp.
| size_t rigidbody::Segment::getDofIdx | ( | const utils::String & | dofName | ) | const |
Return the index of a specified DoF.
| dofName | The name of the DoF |
Definition at line 547 of file Segment.cpp.
| size_t rigidbody::Segment::getFirstDofIndexInGeneralizedCoordinates | ( | const rigidbody::Joints & | model | ) | const |
Returns the first index of the segment in the Generalized Coordinates vector.
| model | The joint model |
Warning: if the current segment does not have any dof, it returns the first index of the parent segment
Definition at line 581 of file Segment.cpp.
| size_t rigidbody::Segment::getLastDofIndexInGeneralizedCoordinates | ( | const rigidbody::Joints & | model | ) | const |
Returns the last index of the segment in the Generalized Coordinates vector.
| model | The joint model |
Warning: if the current segment does not have any dof, it returns the last index of the parent segment
Definition at line 599 of file Segment.cpp.
| size_t rigidbody::Segment::id | ( | ) | const |
| bool rigidbody::Segment::isRotationAQuaternion | ( | ) | const |
Return if the rotation DoF of this segment is a quaternion.
Definition at line 188 of file Segment.cpp.
|
protected |
Check if the vector has the same number of elements as the number of DoF.
| vec | The vector to check |
| isQLevel | If the vector is a Q level or a Qdot/Qddot level. This is important to compute number of rotations when using quaternions |
Definition at line 340 of file Segment.cpp.
| const std::vector< utils::Scalar > & rigidbody::Segment::jointDampings | ( | ) | const |
Return the joint damping to apply to the dynamics.
Definition at line 257 of file Segment.cpp.
| utils::RotoTrans rigidbody::Segment::localJCS | ( | ) | const |
Return the joint coordinate system (JCS) in the parent reference frame.
Definition at line 276 of file Segment.cpp.
| const utils::String & rigidbody::Segment::nameDof | ( | const size_t | i | ) | const |
Return the name of the specified DoF.
| i | The index of the DoF |
Definition at line 212 of file Segment.cpp.
| size_t rigidbody::Segment::nbDof | ( | ) | const |
Return the number of DoF of the segment.
Definition at line 205 of file Segment.cpp.
| size_t rigidbody::Segment::nbDofRot | ( | ) | const |
Return the number of rotation DoF of the segment.
Definition at line 207 of file Segment.cpp.
| size_t rigidbody::Segment::nbDofTrans | ( | ) | const |
Return the number of translation DoF of the segment.
Definition at line 206 of file Segment.cpp.
| size_t rigidbody::Segment::nbGeneralizedTorque | ( | ) | const |
Return the number of generalized torque.
This value is equal to nbQddot
Definition at line 204 of file Segment.cpp.
| size_t rigidbody::Segment::nbQ | ( | ) | const |
Return the number of generalized coordinates.
Definition at line 208 of file Segment.cpp.
| size_t rigidbody::Segment::nbQddot | ( | ) | const |
Return the number of generalized accelerations.
Definition at line 210 of file Segment.cpp.
| size_t rigidbody::Segment::nbQdot | ( | ) | const |
Return the number of generalized velocities.
Definition at line 209 of file Segment.cpp.
| const std::vector< utils::Range > & rigidbody::Segment::QddotRanges | ( | ) | const |
Return the ranges for all the dof acceleration, translations and rotations respectively.
Definition at line 245 of file Segment.cpp.
| const std::vector< utils::Range > & rigidbody::Segment::QdotRanges | ( | ) | const |
Return the ranges for all the dof velocity, translations and rotations respectively.
Definition at line 233 of file Segment.cpp.
| const std::vector< utils::Range > & rigidbody::Segment::QRanges | ( | ) | const |
Return the ranges for all the dof, translations and rotations respectively.
Definition at line 222 of file Segment.cpp.
| const utils::String & rigidbody::Segment::seqR | ( | ) | const |
Return the angle sequence in text.
Definition at line 220 of file Segment.cpp.
| const utils::String & rigidbody::Segment::seqT | ( | ) | const |
Return the translation sequence in text.
Definition at line 218 of file Segment.cpp.
|
protected |
Set the DoF segment characteristics on the last body.
The idea is that since a segment is described by all of its DoF, the inertia and masses must be put on the last body
Definition at line 451 of file Segment.cpp.
|
protected |
Set the DoF.
| model | The joint model |
| seqT | Sequence of the translations |
| seqR | Angle sequence of the Euler rotations |
| QRanges | Ranges of the translations and rotations dof. The length of QRanges must be equal to length of translations and rotations |
| QdotRanges | Ranges of the translations and rotations dof velocity. The length of QdotRanges must be equal to length of translations and rotations |
| QddotRanges | Ranges of the translations and rotations dof acceleration. The length of QddotRanges must be equal to length of translations and rotations |
| jointDamping | The joint damping to apply to the dynamics |
Definition at line 313 of file Segment.cpp.
|
protectedvirtual |
Determine the rotation axis in relation to the requested sequence.
Definition at line 467 of file Segment.cpp.
| void rigidbody::Segment::setJointDampings | ( | const std::vector< utils::Scalar > & | jointDampings | ) |
Set the joint damping to apply to the dynamics.
| jointDampings | The joint damping |
Definition at line 261 of file Segment.cpp.
|
protectedvirtual |
Function that adds the segment to the RBDL body set.
| model | The joint model |
Definition at line 499 of file Segment.cpp.
| void rigidbody::Segment::setLocalJCS | ( | rigidbody::Joints & | model, |
| utils::RotoTrans & | rototrans ) |
set the joint coordinate system (JCS) in the parent reference frame
| model | The model, it's need to update the underlying rbdl model |
| rototrans | The rototranslation object |
Warning: This function doesn't work for segments that have no degree of freedom w.r.t their parent segment.
Definition at line 281 of file Segment.cpp.
|
protected |
Set the total number of DoF.
| nbTrans | Number of translation DoF |
| nbRot | Number of rotation DoF |
Definition at line 403 of file Segment.cpp.
| void rigidbody::Segment::setQddotRanges | ( | const std::vector< utils::Range > & | QddotRanges | ) |
Set the ranges for all the dof acceleration, translations and rotations respectively.
| QddotRanges | The ranges for all the dof acceleration, translations and rotations respectively |
Definition at line 249 of file Segment.cpp.
| void rigidbody::Segment::setQdotRanges | ( | const std::vector< utils::Range > & | QdotRanges | ) |
Set the ranges for all the dof velocity, translations and rotations respectively.
| QdotRanges | The ranges for all the dof velocity, translations and rotations respectively |
Definition at line 237 of file Segment.cpp.
| void rigidbody::Segment::setQRanges | ( | const std::vector< utils::Range > & | QRanges | ) |
Set the ranges for all the dof, translations and rotations respectively.
| QRanges | The ranges for all the dof, translations and rotations respectively |
Definition at line 226 of file Segment.cpp.
|
protected |
Set angle and translation sequences, adjust angle sequence and redeclare if is necessary.
| seqT | Sequence of the translations |
| seqR | Angle sequence of the Euler rotations |
Definition at line 424 of file Segment.cpp.
|
protectedvirtual |
Set the type of the segment.
Implements BIORBD_NAMESPACE::utils::Node.
Definition at line 192 of file Segment.cpp.
|
protected |
Store the sequences.
| seqT | Sequence of the translations |
| seqR | Angle sequence of the Euler rotations |
Definition at line 355 of file Segment.cpp.
|
protected |
Convert a text sequence to its number counterpart (x = 0, y = 1, z = 2, q = 3).
| sequenceInteger | Initialized vector into which the results should be placed in |
| sequenceText | The sequence to convert |
Definition at line 385 of file Segment.cpp.
| void rigidbody::Segment::updateCharacteristics | ( | rigidbody::Joints & | model, |
| const SegmentCharacteristics & | characteristics ) |
updateCharacteristics Change the inertia characteristics of the segment
| model | The underlying model to update |
| characteristics | The new characteristics |
Warning: This function may behave surpringly due to the core of RBDL. The new characteristic values will replace everything which is attach in a fixed manner (that is no degrees-of-freedom). So if your model has 3 segments, but only the first one has dof (and the rest is rigidly attached to the first), then it doesn't matter if idx is 0, 1 or 2, because RBDL considers that all these segment are 1 segment. It is therefore expected that characteristics is the combination of mass and inertia for these 3 segments as well.
Definition at line 290 of file Segment.cpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Minimum and maximum coordinate values that each dof should hold. This is only prescriptive and can be ignored when setting the GeneralizedCoordinates
|
protected |
|
protected |
|
protected |
|
protected |