1#ifndef BIORBD_UTILS_EXTERNAL_FORCE_H
2#define BIORBD_UTILS_EXTERNAL_FORCE_H
4#include "biorbdConfig.h"
8#include "RigidBody/RotoTransNodes.h"
9#include "Utils/RotoTransNode.h"
10#include "Utils/Scalar.h"
11#include "Utils/SpatialVector.h"
13namespace BIORBD_NAMESPACE {
57 std::pair<utils::SpatialVector, utils::RotoTransNode>
get(
int index) {
58 return std::pair<utils::SpatialVector, utils::RotoTransNode>(
76 std::vector<utils::RotoTransNode>
78 std::vector<utils::SpatialVector>
95 bool useTranslationalForces =
true,
96 bool useSoftContacts =
true);
260 std::vector<utils::SpatialVector>& out);
274 std::vector<utils::SpatialVector>& out)
const;
290 std::vector<utils::SpatialVector>& out)
const;
322 std::vector<utils::SpatialVector>
330 std::vector<std::pair<utils::Vector3d, rigidbody::NodeSegment>>
The actual musculoskeletal model that holds everything in biorbd.
This is an internal structure holding the information for the local forces. RotoTransNodes could have...
size_t size() const
Return the number of forces stored.
std::vector< utils::SpatialVector > m_vectors
std::pair< utils::SpatialVector, utils::RotoTransNode > get(int index)
Return the pair force vector/point of application in the local reference frame.
std::vector< utils::RotoTransNode > m_nodes
All the points of application of the forces.
void addNode(const utils::SpatialVector &vector, utils::RotoTransNode node)
Add a force vector and its point of application.
void clear()
Remove all the forces stored.
utils::SpatialVector transportAtOrigin(const utils::SpatialVector &v, const rigidbody::NodeSegment &pointOfApplication) const
Get the rigid contacts in a list of spatial vector of dimension 6xNdof.
bool hasExternalForceInLocalReferenceFrame() const
Return if there is at least one external force expressed in the local reference frame....
Model & m_model
A reference to the kinematic model.
std::vector< utils::SpatialVector > m_externalForces
The vector that holds all the external forces.
bool m_useSoftContacts
If soft contacts should be included.
void combineSoftContactForces(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, std::vector< utils::SpatialVector > &out) const
Add the soft contact forces to the internal Set.
void combineTranslationalForces(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, std::vector< utils::SpatialVector > &out) const
Add the translational forces to the internal Set.
std::vector< std::pair< utils::Vector3d, rigidbody::NodeSegment > > m_translationalForces
std::vector< RigidBodyDynamics::Math::SpatialVector > computeRbdlSpatialVectors(rigidbody::Joints &updatedModel)
The forces in a rbdl compatible format. This won't work if useTranslationalForces or useSoftContacts ...
bool m_useTranslationalForces
If translational forces should be included.
std::vector< utils::SpatialVector > computeSpatialVectors(rigidbody::Joints &updatedModel)
The forces in a rbdl compatible format. This won't work if useTranslationalForces or useSoftContacts ...
void setZero()
Initialize and zero out all the spatial vectors of the Set. Note this should always be called before ...
void addInSegmentReferenceFrame(const utils::String &segmentName, const utils::SpatialVector &vector, const utils::Vector3d &pointOfApplication)
Apply a new value to the specified spatial vector of the Set. WARNING: This vector is expected to be ...
void combineLocalReferenceFrameForces(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, std::vector< utils::SpatialVector > &out)
Add the forces expressed in the local reference to the internal Set.
ExternalForceSet(Model &model, bool useTranslationalForces=true, bool useSoftContacts=true)
Construct ExternalForceSet.
utils::SpatialVector transportForceAtOrigin(const utils::Vector3d &force, const rigidbody::NodeSegment &pointOfApplication) const
Get the rigid contacts in a list of spatial vector of dimension 6xNdof.
void add(const utils::String &segmentName, const utils::SpatialVector &vector)
Apply a new value to the specified spatial vector of the Set. WARNING: This vector is expected to be ...
LocalForcesInternal m_externalForcesInLocal
void addTranslationalForce(const utils::Vector3d &forceInGlobal, const utils::String &segmentName, const utils::Vector3d &pointOfApplicationInLocal)
Add a pure force at a specific point on the kinematic chain.
Class GeneralizedCoordinates.
Class GeneralizedVelocity.
This is the core of the musculoskeletal model in biorbd.
A point attached to a segment, generally speaking a skin marker.
Hold a set of RotoTransNodes.
A RotoTrans which is attached to a segment.
Wrapper of the Eigen::Matrix<double, 6, 1> or Casadi::MX(6, 1).
Wrapper around the std::string class with augmented functionality.
Wrapper around Eigen Vector3d and attach it to a parent.