Biorbd
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
biorbd::rigidbody::Segment Class Reference

Description of a segment. More...

#include <Segment.h>

Inheritance diagram for biorbd::rigidbody::Segment:
biorbd::utils::Node

Public Member Functions

 Segment ()
 Construct a Segment.
 
 Segment (biorbd::rigidbody::Joints &model, const biorbd::utils::String &name, const biorbd::utils::String &parentName, const biorbd::utils::String &seqT, const biorbd::utils::String &seqR, const std::vector< biorbd::utils::Range > &QRanges, const std::vector< biorbd::utils::Range > &QDotRanges, const std::vector< biorbd::utils::Range > &QDDotRanges, const biorbd::rigidbody::SegmentCharacteristics &characteristics, const RigidBodyDynamics::Math::SpatialTransform &cor, int PF=-1)
 Construct a Segment. More...
 
 Segment (biorbd::rigidbody::Joints &model, const biorbd::utils::String &name, const biorbd::utils::String &parentName, const biorbd::utils::String &seqR, const std::vector< biorbd::utils::Range > &QRanges, const std::vector< biorbd::utils::Range > &QDotRanges, const std::vector< biorbd::utils::Range > &QDDotRanges, const biorbd::rigidbody::SegmentCharacteristics &characteristics, const RigidBodyDynamics::Math::SpatialTransform &cor, int PF=-1)
 Construct a Segment. More...
 
biorbd::rigidbody::Segment DeepCopy () const
 Create a deep copy of Segment. More...
 
void DeepCopy (const biorbd::rigidbody::Segment &other)
 Deep copy of Segment. More...
 
virtual ~Segment ()
 Destroy the class properly.
 
unsigned int id () const
 Return the Segment index. More...
 
int platformIdx () const
 Return the platform index. More...
 
const biorbd::utils::StringseqT () const
 Return the translation sequence in text. More...
 
const biorbd::utils::StringseqR () const
 Return the angle sequence in text. More...
 
const std::vector< biorbd::utils::Range > & QRanges () const
 Return the ranges for all the dof, translations and rotations respectively. More...
 
const std::vector< biorbd::utils::Range > & QDotRanges () const
 Return the ranges for all the dof velocity, translations and rotations respectively. More...
 
const std::vector< biorbd::utils::Range > & QDDotRanges () const
 Return the ranges for all the dof acceleration, translations and rotations respectively. More...
 
unsigned int nbDof () const
 Return the number of DoF of the segment. More...
 
unsigned int nbDofTrans () const
 Return the number of translation DoF of the segment. More...
 
unsigned int nbDofRot () const
 Return the number of rotation DoF of the segment. More...
 
unsigned int nbQ () const
 Return the number of generalized coordinates. More...
 
unsigned int nbQdot () const
 Return the number of generalized velocities. More...
 
unsigned int nbQddot () const
 Return the number of generalized accelerations. More...
 
unsigned int nbGeneralizedTorque () const
 Return the number of generalized torque. More...
 
unsigned int getDofIdx (const biorbd::utils::String &dofName) const
 Return the index of a specified DoF. More...
 
const biorbd::utils::StringnameDof (const unsigned int i) const
 Return the name of the specified DoF. More...
 
biorbd::utils::RotoTrans localJCS () const
 Return the joint coordinate system (JCS) in the parent reference frame. More...
 
const biorbd::rigidbody::SegmentCharacteristicscharacteristics () const
 Return the segment characteristics. More...
 
bool isRotationAQuaternion () const
 Return if the rotation DoF of this segment is a quaternion. More...
 
- Public Member Functions inherited from biorbd::utils::Node
 Node ()
 Construct Node.
 
 Node (const biorbd::utils::Node &other)
 Construct Node from another node. More...
 
 Node (const biorbd::utils::String &name)
 Construct Node. More...
 
 Node (const biorbd::utils::String &name, const biorbd::utils::String &parentName)
 Construct Node. More...
 
virtual ~Node ()
 Destroy class properly.
 
void DeepCopy (const biorbd::utils::Node &other)
 Deep copy of the node in another node. More...
 
void setName (const biorbd::utils::String &name)
 Set the name of the node. More...
 
const biorbd::utils::Stringname () const
 Return the name of the node.
 
const biorbd::utils::Stringparent () const
 Return the parent name of the node.
 
void setParent (const biorbd::utils::String &name)
 Set the parent name of the node. More...
 
biorbd::utils::NODE_TYPE typeOfNode () const
 Return the type of node.
 

Protected Member Functions

void setType ()
 Set the type of the segment.
 
void setPF (int idx)
 Set the platform index.
 
void setDofs (biorbd::rigidbody::Joints &model, const biorbd::utils::String &seqT, const biorbd::utils::String &seqR, const std::vector< biorbd::utils::Range > &QRanges, const std::vector< biorbd::utils::Range > &QDotRanges, const std::vector< biorbd::utils::Range > &QDDotRanges)
 Set the DoF. More...
 
void setNumberOfDof (unsigned int nbTrans, unsigned int nbRot)
 Set the total number of DoF. More...
 
void determineIfRotIsQuaternion (const biorbd::utils::String &seqR)
 Determines if DoF in rotation is a Quaternion. More...
 
void setSequence (const biorbd::utils::String &seqT, const biorbd::utils::String &seqR)
 Set angle and translation sequences, adjust angle sequence and redeclare if is necessary. More...
 
void fillSequence ()
 Fill the transation and rotation sequences. More...
 
void str2numSequence (std::vector< unsigned int > &sequenceInteger, const biorbd::utils::String &sequenceText)
 Convert a text sequence to its number counterpart (x = 0, y = 1, z = 2, q = 3) More...
 
void str2numSequence (const biorbd::utils::String &seqT, const biorbd::utils::String &seqR)
 Store the sequences. More...
 
virtual void setJoints (biorbd::rigidbody::Joints &model)
 Function that adds the segment to the RBDL body set. More...
 
virtual void setJointAxis ()
 Determine the rotation axis in relation to the requested sequence.
 
void setDofCharacteristicsOnLastBody ()
 Set the DoF segment characteristics on the last body. More...
 

Protected Attributes

std::shared_ptr< int > m_idxPF
 Platform index which acts on the segment.
 
std::shared_ptr< RigidBodyDynamics::Math::SpatialTransform > m_cor
 Attitude of the segment in parent reference frame.
 
std::shared_ptr< biorbd::utils::Stringm_seqT
 Translation sequence.
 
std::shared_ptr< biorbd::utils::Stringm_seqR
 Euler rotation sequence.
 
std::shared_ptr< std::vector< biorbd::utils::Range > > m_QRanges
 Minimum and maximum coordinate values that each dof should hold. This is only prescriptive and can be ignored when setting the GeneralizedCoordinates.
 
std::shared_ptr< std::vector< biorbd::utils::Range > > m_QDotRanges
 Minimum and maximum velocity values that each dof should hold. This is only prescriptive and can be ignored when setting the GeneralizedVelocities.
 
std::shared_ptr< std::vector< biorbd::utils::Range > > m_QDDotRanges
 Minimum and maximum acceleration values that each dof should hold. This is only prescriptive and can be ignored when setting the GeneralizedAccelerations.
 
std::shared_ptr< unsigned int > m_nbDof
 Number of degrees of freedom.
 
std::shared_ptr< unsigned int > m_nbQdot
 Number of generalized velocities.
 
std::shared_ptr< unsigned int > m_nbQddot
 Number of generalized accelerations.
 
std::shared_ptr< unsigned int > m_nbDofTrue
 Number of degrees of freedom including the extra DoF when there is a quaternion.
 
std::shared_ptr< unsigned int > m_nbDofTrueOutside
 Number of degree of freedom read from the outside (Same as nDof except if Quaternion)
 
std::shared_ptr< unsigned int > m_nbDofTrans
 Number of degrees of freedom in translation.
 
std::shared_ptr< unsigned int > m_nbDofRot
 Number of degrees of freedom in rotation.
 
std::shared_ptr< unsigned int > m_nbDofQuat
 Number of degrees of freedom in rotation if expressed in quaternion.
 
std::shared_ptr< bool > m_isQuaternion
 If DoF in rotation is a Quaternion.
 
std::shared_ptr< std::vector< RigidBodyDynamics::Joint > > m_dof
 Actual DoF: t1, t2, t3, r1, r2, r3; where the order depends on seqT and seqR.
 
std::shared_ptr< std::vector< unsigned int > > m_idxDof
 Index of the parent segment.
 
std::shared_ptr< std::vector< unsigned int > > m_sequenceTrans
 Translation sequence.
 
std::shared_ptr< std::vector< unsigned int > > m_sequenceRot
 Euler rotation sequence.
 
std::shared_ptr< std::vector< biorbd::utils::String > > m_nameDof
 To store the DoF names.
 
std::shared_ptr< std::vector< unsigned int > > m_dofPosition
 Position in the x, y, and z sequence.
 
std::shared_ptr< biorbd::rigidbody::SegmentCharacteristicsm_characteristics
 Non-used virtual segment; it allows to "save" the data and to avoid the use of multiple intermediate variables.
 
std::shared_ptr< std::vector< biorbd::rigidbody::SegmentCharacteristics > > m_dofCharacteristics
 Variable containing the inertial data and other from each segment (on a 6DoF segment, 0 to 4 should be empty and 5 filled)
 
- Protected Attributes inherited from biorbd::utils::Node
std::shared_ptr< biorbd::utils::Stringm_name
 The name of the node.
 
std::shared_ptr< biorbd::utils::Stringm_parentName
 The parent name of the node.
 
std::shared_ptr< biorbd::utils::NODE_TYPE > m_typeOfNode
 The type of the node.
 

Detailed Description

Description of a segment.

Definition at line 23 of file Segment.h.

Constructor & Destructor Documentation

◆ Segment() [1/2]

biorbd::rigidbody::Segment::Segment ( biorbd::rigidbody::Joints model,
const biorbd::utils::String name,
const biorbd::utils::String parentName,
const biorbd::utils::String seqT,
const biorbd::utils::String seqR,
const std::vector< biorbd::utils::Range > &  QRanges,
const std::vector< biorbd::utils::Range > &  QDotRanges,
const std::vector< biorbd::utils::Range > &  QDDotRanges,
const biorbd::rigidbody::SegmentCharacteristics characteristics,
const RigidBodyDynamics::Math::SpatialTransform &  cor,
int  PF = -1 
)

Construct a Segment.

Parameters
modelThe joint model
nameThe name of the segment
parentNameThe name of the parent segment
seqTSequence of the translations
seqRAngle sequence of the Euler rotations
QRangesRanges of the translations and rotations dof. The length of QRanges must be equal to length of translations and rotations
QDotRangesRanges of the translations and rotations dof velocity. The length of QDotRanges must be equal to length of translations and rotations
QDDotRangesRanges of the translations and rotations dof acceleration. The length of QDDotRanges must be equal to length of translations and rotations
characteristicsof the segment (mass, center of mass, inertia, etc.)
corTransformation in parent reference frame
PFPlatform index attached to the body (-1 means no force platform acts on the body)

Definition at line 44 of file Segment.cpp.

◆ Segment() [2/2]

biorbd::rigidbody::Segment::Segment ( biorbd::rigidbody::Joints model,
const biorbd::utils::String name,
const biorbd::utils::String parentName,
const biorbd::utils::String seqR,
const std::vector< biorbd::utils::Range > &  QRanges,
const std::vector< biorbd::utils::Range > &  QDotRanges,
const std::vector< biorbd::utils::Range > &  QDDotRanges,
const biorbd::rigidbody::SegmentCharacteristics characteristics,
const RigidBodyDynamics::Math::SpatialTransform &  cor,
int  PF = -1 
)

Construct a Segment.

Parameters
modelThe joint model
nameThe name of the segment
parentNameThe name of the parent segment
seqRAngle sequence of the Euler rotations
QRangesRanges of the translations and rotations dof. The length of QRanges must be equal to length of translations and rotations
QDotRangesRanges of the translations and rotations dof velocity. The length of QDotRanges must be equal to length of translations and rotations
QDDotRangesRanges of the translations and rotations dof acceleration. The length of QDDotRanges must be equal to length of translations and rotations
characteristicsof the segment (mass, center of mass, inertia, etc.)
corTransformation in parent reference frame
PFPlatform index attached to the body (-1 means no force platform acts on the body)

Definition at line 89 of file Segment.cpp.

Member Function Documentation

◆ characteristics()

const biorbd::rigidbody::SegmentCharacteristics & biorbd::rigidbody::Segment::characteristics ( ) const

Return the segment characteristics.

Returns
The segment characteristics

Definition at line 264 of file Segment.cpp.

◆ DeepCopy() [1/2]

biorbd::rigidbody::Segment biorbd::rigidbody::Segment::DeepCopy ( ) const

Create a deep copy of Segment.

Returns
Copy of Segment

Definition at line 135 of file Segment.cpp.

◆ DeepCopy() [2/2]

void biorbd::rigidbody::Segment::DeepCopy ( const biorbd::rigidbody::Segment other)

Deep copy of Segment.

Parameters
otherThe Segment to copy

Definition at line 142 of file Segment.cpp.

◆ determineIfRotIsQuaternion()

void biorbd::rigidbody::Segment::determineIfRotIsQuaternion ( const biorbd::utils::String seqR)
protected

Determines if DoF in rotation is a Quaternion.

Parameters
seqRCardan sequence to classify the DoF in rotation

If seqR is equal to "q" then it is a quaternion

Definition at line 304 of file Segment.cpp.

◆ fillSequence()

void biorbd::rigidbody::Segment::fillSequence ( )
protected

Fill the transation and rotation sequences.

Places the translations first, followed by the rotations in the asked order.

Definition at line 382 of file Segment.cpp.

◆ getDofIdx()

unsigned int biorbd::rigidbody::Segment::getDofIdx ( const biorbd::utils::String dofName) const

Return the index of a specified DoF.

Returns
The index of a specified DoF

Definition at line 489 of file Segment.cpp.

◆ id()

unsigned int biorbd::rigidbody::Segment::id ( ) const

Return the Segment index.

Returns
The Segment index

Definition at line 190 of file Segment.cpp.

◆ isRotationAQuaternion()

bool biorbd::rigidbody::Segment::isRotationAQuaternion ( ) const

Return if the rotation DoF of this segment is a quaternion.

Returns
If the rotation DoF of this segment is a quaternion

Definition at line 181 of file Segment.cpp.

◆ localJCS()

biorbd::utils::RotoTrans biorbd::rigidbody::Segment::localJCS ( ) const

Return the joint coordinate system (JCS) in the parent reference frame.

Returns
The joint coordinate system in the parent reference frame

Definition at line 261 of file Segment.cpp.

◆ nameDof()

const biorbd::utils::String & biorbd::rigidbody::Segment::nameDof ( const unsigned int  i) const

Return the name of the specified DoF.

Returns
The name of the specified DoF

Definition at line 227 of file Segment.cpp.

◆ nbDof()

unsigned int biorbd::rigidbody::Segment::nbDof ( ) const

Return the number of DoF of the segment.

Returns
The number of Dof of the segment

Definition at line 203 of file Segment.cpp.

◆ nbDofRot()

unsigned int biorbd::rigidbody::Segment::nbDofRot ( ) const

Return the number of rotation DoF of the segment.

Returns
The number of rotation DoF of the segment

Definition at line 209 of file Segment.cpp.

◆ nbDofTrans()

unsigned int biorbd::rigidbody::Segment::nbDofTrans ( ) const

Return the number of translation DoF of the segment.

Returns
The number of translation DoF of the segment

Definition at line 206 of file Segment.cpp.

◆ nbGeneralizedTorque()

unsigned int biorbd::rigidbody::Segment::nbGeneralizedTorque ( ) const

Return the number of generalized torque.

Returns
The number of generalized torque

This value is equal to nbQddot

Definition at line 200 of file Segment.cpp.

◆ nbQ()

unsigned int biorbd::rigidbody::Segment::nbQ ( ) const

Return the number of generalized coordinates.

Returns
The number of generalized coordinates

Definition at line 212 of file Segment.cpp.

◆ nbQddot()

unsigned int biorbd::rigidbody::Segment::nbQddot ( ) const

Return the number of generalized accelerations.

Returns
The number of generalized accelerations

Definition at line 218 of file Segment.cpp.

◆ nbQdot()

unsigned int biorbd::rigidbody::Segment::nbQdot ( ) const

Return the number of generalized velocities.

Returns
The number of generalized velocities

Definition at line 215 of file Segment.cpp.

◆ platformIdx()

int biorbd::rigidbody::Segment::platformIdx ( ) const

Return the platform index.

Returns
The platform index

Definition at line 197 of file Segment.cpp.

◆ QDDotRanges()

const std::vector< biorbd::utils::Range > & biorbd::rigidbody::Segment::QDDotRanges ( ) const

Return the ranges for all the dof acceleration, translations and rotations respectively.

Returns
The ranges for all the dofa acceleration, translations and rotations respectively

Definition at line 256 of file Segment.cpp.

◆ QDotRanges()

const std::vector< biorbd::utils::Range > & biorbd::rigidbody::Segment::QDotRanges ( ) const

Return the ranges for all the dof velocity, translations and rotations respectively.

Returns
The ranges for all the dof velocity, translations and rotations respectively

Definition at line 250 of file Segment.cpp.

◆ QRanges()

const std::vector< biorbd::utils::Range > & biorbd::rigidbody::Segment::QRanges ( ) const

Return the ranges for all the dof, translations and rotations respectively.

Returns
The ranges for all the dof, translations and rotations respectively

Definition at line 244 of file Segment.cpp.

◆ seqR()

const biorbd::utils::String & biorbd::rigidbody::Segment::seqR ( ) const

Return the angle sequence in text.

Returns
The angle sequence in text

Definition at line 238 of file Segment.cpp.

◆ seqT()

const biorbd::utils::String & biorbd::rigidbody::Segment::seqT ( ) const

Return the translation sequence in text.

Returns
The translation sequence in text

Definition at line 233 of file Segment.cpp.

◆ setDofCharacteristicsOnLastBody()

void biorbd::rigidbody::Segment::setDofCharacteristicsOnLastBody ( )
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 395 of file Segment.cpp.

◆ setDofs()

void biorbd::rigidbody::Segment::setDofs ( biorbd::rigidbody::Joints model,
const biorbd::utils::String seqT,
const biorbd::utils::String seqR,
const std::vector< biorbd::utils::Range > &  QRanges,
const std::vector< biorbd::utils::Range > &  QDotRanges,
const std::vector< biorbd::utils::Range > &  QDDotRanges 
)
protected

Set the DoF.

Parameters
modelThe joint model
seqTSequence of the translations
seqRAngle sequence of the Euler rotations
QRangesRanges of the translations and rotations dof. The length of QRanges must be equal to length of translations and rotations
QDotRangesRanges of the translations and rotations dof velocity. The length of QDotRanges must be equal to length of translations and rotations
QDDotRangesRanges of the translations and rotations dof acceleration. The length of QDDotRanges must be equal to length of translations and rotations

Definition at line 268 of file Segment.cpp.

◆ setJoints()

void biorbd::rigidbody::Segment::setJoints ( biorbd::rigidbody::Joints model)
protectedvirtual

Function that adds the segment to the RBDL body set.

Parameters
modelThe joint model

Definition at line 444 of file Segment.cpp.

◆ setNumberOfDof()

void biorbd::rigidbody::Segment::setNumberOfDof ( unsigned int  nbTrans,
unsigned int  nbRot 
)
protected

Set the total number of DoF.

Parameters
nbTransNumber of translation DoF
nbRotNumber of rotation DoF

Definition at line 355 of file Segment.cpp.

◆ setSequence()

void biorbd::rigidbody::Segment::setSequence ( const biorbd::utils::String seqT,
const biorbd::utils::String seqR 
)
protected

Set angle and translation sequences, adjust angle sequence and redeclare if is necessary.

Parameters
seqTSequence of the translations
seqRAngle sequence of the Euler rotations

Definition at line 377 of file Segment.cpp.

◆ str2numSequence() [1/2]

void biorbd::rigidbody::Segment::str2numSequence ( const biorbd::utils::String seqT,
const biorbd::utils::String seqR 
)
protected

Store the sequences.

Parameters
seqTSequence of the translations
seqRAngle sequence of the Euler rotations

Definition at line 311 of file Segment.cpp.

◆ str2numSequence() [2/2]

void biorbd::rigidbody::Segment::str2numSequence ( std::vector< unsigned int > &  sequenceInteger,
const biorbd::utils::String sequenceText 
)
protected

Convert a text sequence to its number counterpart (x = 0, y = 1, z = 2, q = 3)

Parameters
sequenceIntegerInitialized vector into which the results should be placed in
sequenceTextThe sequence to convert

Definition at line 337 of file Segment.cpp.


The documentation for this class was generated from the following files: