Biorbd Release_1.13.0
Loading...
Searching...
No Matches
Geometry.h
1#ifndef BIORBD_INTERNAL_FORCES_GEOMETRY_H
2#define BIORBD_INTERNAL_FORCES_GEOMETRY_H
3
4#include "biorbdConfig.h"
5
6#include <memory>
7#include <vector>
8
9#include "Utils/Scalar.h"
10
11namespace BIORBD_NAMESPACE {
12namespace utils {
13class Matrix;
14class Vector;
15class Vector3d;
16} // namespace utils
17
18namespace rigidbody {
19class Joints;
22} // namespace rigidbody
23
24namespace internal_forces {
25class PathModifiers;
26class Characteristics;
27
31class BIORBD_API Geometry {
32 public:
36 Geometry();
37
43 Geometry(const utils::Vector3d& origin, const utils::Vector3d& insertion);
44
49 Geometry DeepCopy() const;
50
55 void DeepCopy(const Geometry& other);
56
72 rigidbody::Joints& updatedModel,
73 const rigidbody::GeneralizedCoordinates* Q = nullptr,
74 const rigidbody::GeneralizedVelocity* Qdot = nullptr);
75
92 rigidbody::Joints& updatedModel,
93 internal_forces::PathModifiers& pathModifiers,
94 const rigidbody::GeneralizedCoordinates* Q = nullptr,
95 const rigidbody::GeneralizedVelocity* Qdot = nullptr);
96
106 void updateKinematics(
107 std::vector<utils::Vector3d>& musclePointsInGlobal,
108 utils::Matrix& jacoPointsInGlobal,
109 const rigidbody::GeneralizedVelocity* Qdot = nullptr);
110
115 void setOrigin(const utils::Vector3d& position);
116
121 const utils::Vector3d& originInLocal() const;
122
127 void setInsertionInLocal(const utils::Vector3d& position);
128
133 const utils::Vector3d& insertionInLocal() const;
134
142 const utils::Vector3d& originInGlobal() const;
143
150 const utils::Vector3d& insertionInGlobal() const;
151
159 const std::vector<utils::Vector3d>& pointsInGlobal() const;
160
165 const utils::Scalar& length() const;
166
171 const utils::Scalar& velocity() const;
172
177 const utils::Matrix& jacobian() const;
178
184
190
196 utils::Matrix jacobian(size_t idxViaPoint) const;
197
202 const utils::Matrix& jacobianLength() const;
203
204 protected:
212 internal_forces::PathModifiers* pathModifiers = nullptr);
213
221 rigidbody::Joints& model,
223
232 rigidbody::Joints& model,
234
239 void setPointsInGlobal(std::vector<utils::Vector3d>& ptsInGlobal);
240
248 rigidbody::Joints& model,
250 internal_forces::PathModifiers* pathModifiers = nullptr);
251
257 const utils::Scalar& length(
258 internal_forces::PathModifiers* pathModifiers = nullptr);
259
266 const utils::Scalar& velocity(const rigidbody::GeneralizedVelocity& Qdot);
267
273
278 void jacobian(const utils::Matrix& jaco);
279
284 // const Characteristics* characteristics = nullptr,
286 void jacobian(
287 rigidbody::Joints& model,
289
294
295 // Position des nodes dans le repere local
296 std::shared_ptr<utils::Vector3d> m_origin;
297 std::shared_ptr<utils::Vector3d> m_insertion;
298
299 std::shared_ptr<utils::Vector3d>
301 std::shared_ptr<utils::Vector3d>
304 std::shared_ptr<std::vector<utils::Vector3d>>
306 std::shared_ptr<std::vector<utils::Vector3d>>
308 std::shared_ptr<utils::Matrix> m_jacobian;
309 std::shared_ptr<utils::Matrix>
311
312 std::shared_ptr<utils::Scalar> m_length;
313 std::shared_ptr<utils::Scalar>
315
316 std::shared_ptr<bool> m_isGeometryComputed;
318 std::shared_ptr<bool> m_isVelocityComputed;
320 std::shared_ptr<bool>
323};
324
325} // namespace internal_forces
326} // namespace BIORBD_NAMESPACE
327
328#endif // BIORBD_INTERNAL_FORCES_GEOMETRY_H
std::shared_ptr< utils::Matrix > m_jacobianLength
The muscle length jacobian.
Definition Geometry.h:310
std::shared_ptr< utils::Vector3d > m_insertion
Insertion node.
Definition Geometry.h:297
utils::Matrix jacobianOrigin() const
Return the gradient of the jacobian for the origin node.
Definition Geometry.cpp:207
const utils::Vector3d & insertionInGlobal() const
Return the insertion position in the global reference.
Definition Geometry.cpp:169
utils::Matrix jacobianInsertion() const
Return the gradient of the jacobian for the insertion node.
Definition Geometry.cpp:213
const utils::Scalar & velocity() const
Return the previously computed velocity.
Definition Geometry.cpp:193
std::shared_ptr< bool > m_isGeometryComputed
Definition Geometry.h:316
std::shared_ptr< utils::Matrix > m_jacobian
The jacobian matrix.
Definition Geometry.h:308
std::shared_ptr< utils::Vector3d > m_originInGlobal
Position of the origin in the global reference.
Definition Geometry.h:300
void computeJacobianLength()
Compute the muscle length jacobian.
Definition Geometry.cpp:444
void setPointsInGlobal(std::vector< utils::Vector3d > &ptsInGlobal)
Set the muscle points in global.
Definition Geometry.cpp:271
std::shared_ptr< bool > m_posAndJacoWereForced
Definition Geometry.h:321
const utils::Vector3d & insertionInLocal() const
Return the insertion position.
Definition Geometry.cpp:158
Geometry DeepCopy() const
Deep copy of a geometry.
Definition Geometry.cpp:58
std::shared_ptr< utils::Scalar > m_length
length
Definition Geometry.h:312
const std::vector< utils::Vector3d > & pointsInGlobal() const
Return the muscles points in the global reference.
Definition Geometry.cpp:176
void setInsertionInLocal(const utils::Vector3d &position)
Set the insertion position.
Definition Geometry.cpp:149
std::shared_ptr< utils::Scalar > m_velocity
Velocity of the muscular elongation.
Definition Geometry.h:314
std::shared_ptr< utils::Vector3d > m_insertionInGlobal
Definition Geometry.h:302
void setJacobianDimension(rigidbody::Joints &model)
Set the jacobian dimensions.
Definition Geometry.cpp:416
const utils::Matrix & jacobian() const
Return the previously computed muscle jacobian.
Definition Geometry.cpp:201
void _updateKinematics(const rigidbody::GeneralizedVelocity *Qdot, internal_forces::PathModifiers *pathModifiers=nullptr)
Actual function that implements the update of the kinematics.
Definition Geometry.cpp:236
std::shared_ptr< std::vector< utils::Vector3d > > m_pointsInLocal
Position of all the points in local.
Definition Geometry.h:307
const utils::Vector3d & originInGlobal() const
Return the origin position in the global reference.
Definition Geometry.cpp:163
const utils::Matrix & jacobianLength() const
Return the jacobian length of the muscle.
Definition Geometry.cpp:227
void updateKinematics(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates *Q=nullptr, const rigidbody::GeneralizedVelocity *Qdot=nullptr)
Updates the position and dynamic elements of the muscles.
Definition Geometry.cpp:88
void setOrigin(const utils::Vector3d &position)
Set the origin position in the local reference frame of the muscle.
Definition Geometry.cpp:137
std::shared_ptr< bool > m_isVelocityComputed
Definition Geometry.h:318
std::shared_ptr< utils::Vector3d > m_origin
Origin node.
Definition Geometry.h:296
const utils::Scalar & length() const
Return the previously computed muscle length.
Definition Geometry.cpp:186
const utils::Vector3d & originInLocal() const
Return the origin position.
Definition Geometry.cpp:145
std::shared_ptr< std::vector< utils::Vector3d > > m_pointsInGlobal
Position of all the points in the global reference.
Definition Geometry.h:305
Holder of all the path modifiers of a muscle.
This is the core of the musculoskeletal model in biorbd.
Definition Joints.h:48
A wrapper for the Eigen::MatrixXd.
Definition Matrix.h:18
Wrapper around Eigen Vector3d and attach it to a parent.
Definition Vector3d.h:27
Wrapper of the Eigen VectorXd.
Definition Vector.h:21