1#define BIORBD_API_EXPORTS
3#include "InternalForces/Muscles/MuscleGeometry.h"
7#include <rbdl/Kinematics.h>
9#include "InternalForces/Geometry.h"
10#include "InternalForces/Muscles/Characteristics.h"
11#include "InternalForces/PathModifiers.h"
12#include "InternalForces/ViaPoint.h"
13#include "InternalForces/WrappingObject.h"
14#include "RigidBody/GeneralizedCoordinates.h"
15#include "RigidBody/GeneralizedVelocity.h"
16#include "RigidBody/Joints.h"
17#include "RigidBody/NodeSegment.h"
18#include "Utils/Error.h"
19#include "Utils/Matrix.h"
20#include "Utils/RotoTrans.h"
22using namespace BIORBD_NAMESPACE;
34 : internal_forces::
Geometry(origin, insertion),
108 "Geometry must be computed at least before calling length()");
116 "Geometry must be computed at least before calling length()");
127 length(characteristics, pathModifiers);
132 if (Qdot !=
nullptr) {
147 if (pathModifiers !=
nullptr && pathModifiers->
nbWraps() != 0) {
149 pathModifiers->
nbVia() == 0,
"Cannot mix wrapping and via points yet");
152 "Cannot compute more than one wrapping yet");
158 utils::Scalar lengthWrap(0);
163 ((*m_pointsInGlobal)[0] - po_wrap).norm() +
165 ((*m_pointsInGlobal)[3] - pi_wrap).norm();
170 ((*m_pointsInGlobal)[i + 1] - (*m_pointsInGlobal)[i]).norm();
Geometry()
Construct geometry.
const utils::Scalar & velocity() const
Return the previously computed velocity.
std::shared_ptr< bool > m_isGeometryComputed
void computeJacobianLength()
Compute the muscle length jacobian.
void setPointsInGlobal(std::vector< utils::Vector3d > &ptsInGlobal)
Set the muscle points in global.
std::shared_ptr< bool > m_posAndJacoWereForced
Geometry DeepCopy() const
Deep copy of a geometry.
const std::vector< utils::Vector3d > & pointsInGlobal() const
Return the muscles points in the global reference.
const utils::Matrix & jacobian() const
Return the previously computed muscle jacobian.
std::shared_ptr< bool > m_isVelocityComputed
std::shared_ptr< std::vector< utils::Vector3d > > m_pointsInGlobal
Position of all the points in the global reference.
Holder of all the path modifiers of a muscle.
size_t nbVia() const
Return the total number of via points in the set.
size_t nbWraps() const
Return the total number of wrapping objects in the set.
utils::Vector3d & object(size_t idx)
Return the object at a specific index in the set.
Base class for the wrapping objects.
virtual void wrapPoints(const utils::RotoTrans &rt, const utils::Vector3d &p1_bone, const utils::Vector3d &p2_bone, utils::Vector3d &p1, utils::Vector3d &p2, utils::Scalar *muscleLength=nullptr)=0
From the position of the wrapping object, return the 2 locations where the muscle leaves the wrapping...
Class Holds that muscle characteristics.
const utils::Scalar & pennationAngle() const
Return the angle of pennation.
const utils::Scalar & tendonSlackLength() const
Return the tendon slack length.
Class muscle geometry of the muscle.
std::shared_ptr< utils::Scalar > m_muscleTendonLength
muscle tendon length
const utils::Scalar & musculoTendonLength() const
Return the previously computed muscle tendon length.
std::shared_ptr< utils::Scalar > m_muscleLength
length
void updateKinematics(rigidbody::Joints &updatedModel, const Characteristics &characteristics, const rigidbody::GeneralizedCoordinates *Q=nullptr, const rigidbody::GeneralizedVelocity *Qdot=nullptr)
Updates the position and dynamic elements of the muscles.
MuscleGeometry()
Construct muscle geometry.
void _updateKinematics(const rigidbody::GeneralizedVelocity *Qdot, const Characteristics *characteristics, internal_forces::PathModifiers *pathModifiers=nullptr)
Actual function that implements the update of the kinematics.
MuscleGeometry DeepCopy() const
Deep copy of a muscle geometry.
const utils::Scalar & length() const
Return the previously computed muscle length.
Class GeneralizedCoordinates.
Class GeneralizedVelocity.
This is the core of the musculoskeletal model in biorbd.
static void check(bool cond, const String &message)
Assert that raises the error message if false.
A wrapper for the Eigen::MatrixXd.
Wrapper around Eigen Vector3d and attach it to a parent.