1 #define BIORBD_API_EXPORTS
2 #include "RigidBody/RotoTransNodes.h"
4 #include <rbdl/Model.h>
5 #include <rbdl/Kinematics.h>
6 #include "Utils/String.h"
7 #include "Utils/Matrix.h"
8 #include "Utils/Rotation.h"
9 #include "Utils/RotoTransNode.h"
10 #include "RigidBody/GeneralizedCoordinates.h"
11 #include "RigidBody/Joints.h"
12 #include "RigidBody/Segment.h"
15 m_RTs(std::make_shared<std::vector<biorbd::utils::RotoTransNode>>())
39 m_RTs->resize(other.
m_RTs->size());
40 for (
unsigned int i=0; i<other.
m_RTs->size(); ++i)
41 (*m_RTs)[i] = (*other.
m_RTs)[i].DeepCopy();
58 return static_cast<unsigned int>(m_RTs->size());
71 std::vector<biorbd::utils::RotoTransNode> pos;
72 for (
unsigned int i=0; i<nbRTs(); ++i)
73 if (!RT(i).parent().compare(segmentName))
95 std::vector<biorbd::utils::RotoTransNode> pos;
96 for (
unsigned int i=0; i<nbRTs(); ++i)
97 pos.push_back(RT(Q, i,
false));
134 std::vector<biorbd::utils::RotoTransNode> pos;
135 for (
unsigned int i=0; i<nbRTs(); ++i)
136 if (!((*m_RTs)[i]).parent().compare(name))
137 pos.push_back(RT(Q,i,
false));
153 std::vector<biorbd::utils::Matrix> G;
155 for (
unsigned int idx=0; idx<nbRTs(); ++idx){
159 unsigned int id = model.GetBodyId(node.
parent().c_str());
174 std::vector<biorbd::utils::String> names;
175 for (
unsigned int i=0; i<nbRTs(); ++i)
176 names.push_back(RT(i).biorbd::utils::Node::name());
RotoTransNodes()
Construct RT set.
std::shared_ptr< std::vector< biorbd::utils::RotoTransNode > > m_RTs
All the RTs.
Class GeneralizedCoordinates.
A RotoTrans which is attached to a segment.
const biorbd::utils::String & name() const
Return the name of the node.
biorbd::utils::RotoTrans globalJCS(const biorbd::rigidbody::GeneralizedCoordinates &Q, const biorbd::utils::String &name)
Return the joint coordinate system (JCS) for the segment in global reference frame at a given Q.
int GetBodyBiorbdId(const biorbd::utils::String &segmentName) const
Return the biorbd body identification.
const std::vector< biorbd::utils::RotoTransNode > & RTs() const
Return all the RTs in the local reference of the segment.
This is the core of the musculoskeletal model in biorbd.
virtual ~RotoTransNodes()
Destroy the class properly.
const biorbd::rigidbody::Segment & segment(unsigned int idx) const
Get a segment of index idx.
Hold a set of RotoTransNodes.
A wrapper for the Eigen::MatrixXd.
void CalcMatRotJacobian(const biorbd::rigidbody::GeneralizedCoordinates &Q, unsigned int segmentIdx, const RigidBodyDynamics::Math::Matrix3d &rotation, RigidBodyDynamics::Math::MatrixNd &G, bool updateKin)
Calculate the jacobian matrix of a rotation matrix.
void addRT()
Add a new RT to the set.
unsigned int nbRTs() const
Return the number of RTs in the set.
std::vector< biorbd::utils::String > RTsNames()
Return the names of the RTs.
Wrapper around the std::string class with augmented functionality.
const biorbd::utils::RotoTransNode & RT(unsigned int idx)
Return the RTs of a specified index.
biorbd::rigidbody::RotoTransNodes DeepCopy() const
Deep copy of the RTs data.
std::vector< biorbd::utils::RotoTransNode > segmentRTs(const biorbd::rigidbody::GeneralizedCoordinates &Q, unsigned int idx, bool updateKin=true)
Return all the RTs on a specified segment.
void UpdateKinematicsCustom(const biorbd::rigidbody::GeneralizedCoordinates *Q=nullptr, const biorbd::rigidbody::GeneralizedVelocity *Qdot=nullptr, const biorbd::rigidbody::GeneralizedAcceleration *Qddot=nullptr)
Update the kinematic variables such as body velocities and accelerations in the model to reflect the ...
const biorbd::utils::String & parent() const
Return the parent name of the node.
std::vector< biorbd::utils::Matrix > RTsJacobian(const biorbd::rigidbody::GeneralizedCoordinates &Q, bool updateKin=true)
Return the jacobian of the RTs.
biorbd::utils::Rotation rot() const
Return the rotation matrix.