1#ifndef BIORBD_RIGIDBODY_SEGMENT_H
2#define BIORBD_RIGIDBODY_SEGMENT_H
4#include "biorbdConfig.h"
10#include <rbdl/Joint.h>
12#include "Utils/Node.h"
13#include "Utils/Scalar.h"
15namespace BIORBD_NAMESPACE {
62 const std::vector<utils::Range> &
QRanges,
65 const std::vector<utils::Scalar> &jointDamping,
93 const std::vector<utils::Range> &
QRanges,
96 const std::vector<utils::Scalar> &jointDamping,
141 const std::vector<utils::Range> &
QRanges()
const;
157 const std::vector<utils::Range> &
QdotRanges()
const;
173 const std::vector<utils::Range> &
QddotRanges()
const;
198 size_t nbDof()
const;
345 std::shared_ptr<utils::SpatialTransform>
367 const std::vector<utils::Range> &
QRanges,
370 const std::vector<utils::Scalar> &jointDamping);
379 template <
typename T>
394 std::shared_ptr<size_t>
397 std::shared_ptr<size_t>
400 std::shared_ptr<size_t>
402 std::shared_ptr<size_t>
407 std::shared_ptr<std::vector<utils::Range>>
411 std::shared_ptr<std::vector<utils::Range>>
415 std::shared_ptr<std::vector<utils::Range>>
420 std::shared_ptr<std::vector<utils::Scalar>>
433 std::shared_ptr<std::vector<RigidBodyDynamics::Joint>>
436 std::shared_ptr<std::vector<size_t>>
463 std::vector<size_t> &sequenceInteger,
473 std::shared_ptr<std::vector<size_t>>
475 std::shared_ptr<std::vector<size_t>>
477 std::shared_ptr<std::vector<utils::String>>
491 std::shared_ptr<std::vector<size_t>>
502 std::shared_ptr<SegmentCharacteristics>
506 std::shared_ptr<std::vector<SegmentCharacteristics>>
This is the core of the musculoskeletal model in biorbd.
Characteristics of a segment, namely the mass, the center of mass, the inertia, the length and its me...
Description of a segment.
std::shared_ptr< std::vector< utils::String > > m_nameDof
To store the DoF names.
std::shared_ptr< std::vector< RigidBodyDynamics::Joint > > m_dof
bool isRotationAQuaternion() const
Return if the rotation DoF of this segment is a quaternion.
SegmentCharacteristics & characteristics()
Return the segment characteristics.
const std::vector< utils::Range > & QRanges() const
Return the ranges for all the dof, translations and rotations respectively.
utils::RotoTrans localJCS() const
Return the joint coordinate system (JCS) in the parent reference frame.
std::shared_ptr< bool > m_isQuaternion
If DoF in rotation is a Quaternion.
const utils::String & seqT() const
Return the translation sequence in text.
size_t getDofIdx(const utils::String &dofName) const
Return the index of a specified DoF.
std::shared_ptr< utils::SpatialTransform > m_cor
Attitude of the segment in parent reference frame.
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).
std::shared_ptr< utils::String > m_seqT
Translation sequence.
std::shared_ptr< std::vector< SegmentCharacteristics > > m_dofCharacteristics
Segment DeepCopy() const
Create a deep copy of Segment.
std::shared_ptr< std::vector< utils::Range > > m_QdotRanges
std::shared_ptr< int > m_idxInModel
Index in RBDL model.
std::shared_ptr< std::vector< size_t > > m_sequenceTrans
Translation sequence.
void determineIfRotIsQuaternion(const utils::String &seqR)
Determines if DoF in rotation is a Quaternion.
size_t getLastDofIndexInGeneralizedCoordinates(const rigidbody::Joints &model) const
Returns the last index of the segment in the Generalized Coordinates vector.
void fillSequence()
Fill the transation and rotation sequences.
virtual void setJointAxis()
Determine the rotation axis in relation to the requested sequence.
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 lea...
const utils::String & nameDof(const size_t i) const
Return the name of the specified DoF.
size_t nbGeneralizedTorque() const
Return the number of generalized torque.
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.
size_t nbDofTrans() const
Return the number of translation DoF of the segment.
size_t nbQddot() const
Return the number of generalized accelerations.
void setDofCharacteristicsOnLastBody()
Set the DoF segment characteristics on the last body.
std::shared_ptr< size_t > m_nbDofTrueOutside
std::shared_ptr< std::vector< utils::Range > > m_QddotRanges
const std::vector< utils::Range > & QdotRanges() const
Return the ranges for all the dof velocity, translations and rotations respectively.
const utils::String & seqR() const
Return the angle sequence in text.
const std::vector< utils::Scalar > & jointDampings() const
Return the joint damping to apply to the dynamics.
void setQRanges(const std::vector< utils::Range > &QRanges)
Set the ranges for all the dof, translations and rotations respectively.
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.
std::shared_ptr< std::vector< utils::Range > > m_QRanges
size_t nbQ() const
Return the number of generalized coordinates.
std::shared_ptr< size_t > m_nbQddot
Number of generalized accelerations.
size_t getFirstDofIndexInGeneralizedCoordinates(const rigidbody::Joints &model) const
Returns the first index of the segment in the Generalized Coordinates vector.
size_t nbDofRot() const
Return the number of rotation DoF of the segment.
void setLocalJCS(rigidbody::Joints &model, utils::RotoTrans &rototrans)
set the joint coordinate system (JCS) in the parent reference frame
std::shared_ptr< size_t > m_nbDofQuat
void setType()
Set the type of the segment.
void setQddotRanges(const std::vector< utils::Range > &QddotRanges)
Set the ranges for all the dof acceleration, translations and rotations respectively.
std::shared_ptr< std::vector< utils::Scalar > > m_jointDampings
The joint dampings to apply to the dynamics.
virtual void setJoints(rigidbody::Joints &model)
Function that adds the segment to the RBDL body set.
size_t id() const
Return the Segment index.
std::shared_ptr< SegmentCharacteristics > m_characteristics
const std::vector< utils::Range > & QddotRanges() const
Return the ranges for all the dof acceleration, translations and rotations respectively.
size_t nbQdot() const
Return the number of generalized velocities.
std::shared_ptr< std::vector< size_t > > m_sequenceRot
Euler rotation sequence.
size_t nbDof() const
Return the number of DoF of the segment.
void updateCharacteristics(rigidbody::Joints &model, const SegmentCharacteristics &characteristics)
updateCharacteristics Change the inertia characteristics of the segment
void setNumberOfDof(size_t nbTrans, size_t nbRot)
Set the total number of DoF.
std::shared_ptr< size_t > m_nbDofTrue
void setJointDampings(const std::vector< utils::Scalar > &jointDampings)
Set the joint damping to apply to the dynamics.
std::shared_ptr< size_t > m_nbDofRot
Number of degrees of freedom in rotation.
void setSequence(const utils::String &seqT, const utils::String &seqR)
Set angle and translation sequences, adjust angle sequence and redeclare if is necessary.
std::shared_ptr< std::vector< size_t > > m_dofPosition
Position in the x, y, and z sequence.
std::shared_ptr< size_t > m_nbDofTrans
Number of degrees of freedom in translation.
std::shared_ptr< size_t > m_nbQdot
Number of generalized velocities.
Segment()
Construct a Segment.
std::shared_ptr< size_t > m_nbDof
Number of degrees of freedom.
std::shared_ptr< std::vector< size_t > > m_idxDof
Index of the parent segment.
void setQdotRanges(const std::vector< utils::Range > &QdotRanges)
Set the ranges for all the dof velocity, translations and rotations respectively.
std::shared_ptr< utils::String > m_seqR
Euler rotation sequence.
A node is an abstract element which is assigned to a parent.
const String & name() const
Return the name of the node.
Homogenous matrix to describe translations and rotations simultaneously.
Wrapper around the std::string class with augmented functionality.