1 #ifndef BIORBD_RIGIDBODY_JOINTS_H
2 #define BIORBD_RIGIDBODY_JOINTS_H
5 #include <rbdl/Model.h>
6 #include <rbdl/Constraints.h>
7 #include "biorbdConfig.h"
21 class GeneralizedCoordinates;
22 class GeneralizedVelocity;
23 class GeneralizedAcceleration;
24 class GeneralizedTorque;
28 class SegmentCharacteristics;
36 class BIORBD_API Joints
38 class BIORBD_API
Joints :
public RigidBodyDynamics::Model
86 unsigned int AddSegment(
91 const std::vector<biorbd::utils::Range>& QRanges,
92 const std::vector<biorbd::utils::Range>& QDotRanges,
93 const std::vector<biorbd::utils::Range>& QDDotRanges,
95 const RigidBodyDynamics::Math::SpatialTransform& centreOfRotation,
110 unsigned int AddSegment(
114 const std::vector<biorbd::utils::Range>& QRanges,
115 const std::vector<biorbd::utils::Range>& QDotRanges,
116 const std::vector<biorbd::utils::Range>& QDDotRanges,
118 const RigidBodyDynamics::Math::SpatialTransform& centreOfRotation,
149 unsigned int nbGeneralizedTorque()
const;
155 unsigned int nbSegment()
const;
161 unsigned int nbDof()
const;
169 unsigned int getDofIndex(
177 std::vector<biorbd::utils::String> nameDof()
const;
183 unsigned int nbQ()
const;
189 unsigned int nbQdot()
const;
195 unsigned int nbQddot()
const;
201 unsigned int nbRoot()
const;
207 unsigned int nbQuat()
const;
215 unsigned int idx)
const;
234 std::vector<RigidBodyDynamics::Math::SpatialVector> dispatchedForce(
235 std::vector<std::vector<biorbd::utils::SpatialVector>> &spatialVector,
236 unsigned int frame)
const;
243 std::vector<RigidBodyDynamics::Math::SpatialVector> dispatchedForce(
244 std::vector<biorbd::utils::SpatialVector> &sv)
const;
254 void UpdateKinematicsCustom(
267 std::vector<biorbd::utils::RotoTrans> allGlobalJCS(
276 std::vector<biorbd::utils::RotoTrans> allGlobalJCS()
const;
316 unsigned int idx)
const;
322 std::vector<biorbd::utils::RotoTrans> localJCS()
const;
338 const unsigned int idx)
const;
354 bool updateKin=
true);
367 std::vector<biorbd::rigidbody::NodeSegment> projectPoint(
369 const std::vector<biorbd::rigidbody::NodeSegment> &v,
370 bool updateKin=
true);
423 std::vector<biorbd::utils::Matrix> projectPointJacobian(
425 const std::vector<biorbd::rigidbody::NodeSegment> &v,
445 bool updateKin=
true);
453 std::vector<biorbd::rigidbody::NodeSegment> CoMbySegment(
455 bool updateKin=
true);
465 bool updateKin=
true);
476 const unsigned int idx,
477 bool updateKin=
true);
508 std::vector<biorbd::utils::Vector3d> CoMdotBySegment(
511 bool updateKin=
true);
524 const unsigned int idx,
525 bool updateKin=
true);
535 std::vector<biorbd::utils::Vector3d> CoMddotBySegment(
539 bool updateKin=
true);
554 const unsigned int idx,
555 bool updateKin=
true);
574 std::vector<std::vector<biorbd::utils::Vector3d>> meshPoints(
576 bool updateKin =
true);
585 std::vector<biorbd::utils::Vector3d> meshPoints(
588 bool updateKin =
true);
596 std::vector<biorbd::utils::Matrix> meshPointsInMatrix(
598 bool updateKin =
true
605 std::vector<std::vector<MeshFace> > meshFaces()
const;
612 const std::vector<biorbd::rigidbody::MeshFace> &meshFaces(
613 unsigned int idx)
const;
619 std::vector<biorbd::rigidbody::Mesh> mesh()
const;
627 unsigned int idx)
const;
642 bool updateKin =
true);
652 bool updateKin =
true);
687 std::vector<biorbd::utils::Vector3d> CalcSegmentsAngularMomentum (
700 std::vector<biorbd::utils::Vector3d> CalcSegmentsAngularMomentum (
715 void CalcMatRotJacobian (
717 unsigned int segmentIdx,
718 const RigidBodyDynamics::Math::Matrix3d &rotation,
719 RigidBodyDynamics::Math::MatrixNd &G,
732 const double k_stab = 1);
747 std::vector<biorbd::utils::SpatialVector>* f_ext =
nullptr);
761 std::vector<biorbd::utils::SpatialVector>* f_ext =
nullptr);
777 std::vector<biorbd::utils::SpatialVector>* f_ext =
nullptr);
791 std::vector<biorbd::utils::SpatialVector>* f_ext =
nullptr);
805 std::vector<biorbd::utils::SpatialVector>* f_ext =
nullptr);
818 std::shared_ptr<std::vector<biorbd::rigidbody::Segment>>
m_segments;
822 std::shared_ptr<unsigned int>
m_nbQ;
836 RigidBodyDynamics::Math::SpatialTransform CalcBodyWorldTransformation(
838 const unsigned int segmentIdx,
839 bool updateKin =
true);
848 RigidBodyDynamics::Math::SpatialTransform CalcBodyWorldTransformation(
849 const unsigned int segmentIdx)
const;
857 std::vector<biorbd::utils::Vector3d> meshPoints(
858 const std::vector<biorbd::utils::RotoTrans> &RT,
859 unsigned int idx)
const;
869 void checkGeneralizedDimensions(
878 #endif // BIORBD_RIGIDBODY_JOINTS_H