Biorbd Release_1.13.0
Loading...
Searching...
No Matches
BIORBD_NAMESPACE::rigidbody::ExternalForceSet Class Reference

An External force set that can apply forces to the model while computing the dynamics. More...

#include <ExternalForceSet.h>

Classes

class  LocalForcesInternal
 This is an internal structure holding the information for the local forces. RotoTransNodes could have suffised, but we need to have a structure that was holding the spatial vector as well. More...

Public Member Functions

 ExternalForceSet (Model &model, bool useTranslationalForces=true, bool useSoftContacts=true)
 Construct ExternalForceSet.
 ~ExternalForceSet ()
 Delete the set and free the ressources.
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 acting on segmentName, applied at origin and expressed in the global reference frame. method offered by ExternalForceSet below.
void add (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 acting on segmentName, applied at pointOfApplication and expressed in the global reference frame.
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 acting on segmentName, applied at pointOfApplication and expressed in the segment reference frame.
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.
void addTranslationalForce (const utils::Vector3d &force, const rigidbody::NodeSegment &pointOfApplication)
 Add a pure force at a specific point on the kinematic chain.
void setZero ()
 Initialize and zero out all the spatial vectors of the Set. Note this should always be called before reusing an ExternalForceSet unless one is absolutely sure that all the spatial vectors of the Set is in an expected state (that is, all the vectors were either set or zeroed).
std::vector< RigidBodyDynamics::Math::SpatialVector > computeRbdlSpatialVectors (rigidbody::Joints &updatedModel)
 The forces in a rbdl compatible format. This won't work if useTranslationalForces or useSoftContacts is set to true.
std::vector< RigidBodyDynamics::Math::SpatialVector > computeRbdlSpatialVectors (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q)
 The forces in a rbdl compatible format. This won't work if useSoftContacts is set to true.
std::vector< RigidBodyDynamics::Math::SpatialVector > computeRbdlSpatialVectors (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot)
 The forces in a rbdl compatible format.
std::vector< utils::SpatialVector > computeSpatialVectors (rigidbody::Joints &updatedModel)
 The forces in a rbdl compatible format. This won't work if useTranslationalForces or useSoftContacts is set to true.
std::vector< utils::SpatialVector > computeSpatialVectors (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q)
 The forces in a rbdl compatible format. This won't work if useSoftContacts is set to true.
std::vector< utils::SpatialVector > computeSpatialVectors (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot)
 The forces in a rbdl compatible format.
bool hasExternalForceInLocalReferenceFrame () const
 Return if there is at least one external force expressed in the local reference frame. This is important since having this forces to send Q when computing the force in global reference frame.

Protected Member Functions

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.
void combineTranslationalForces (rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, std::vector< utils::SpatialVector > &out) const
 Add the translational forces to the internal Set.
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.
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.
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.

Protected Attributes

Model & m_model
 A reference to the kinematic model.
bool m_useTranslationalForces
 If translational forces should be included.
bool m_useSoftContacts
 If soft contacts should be included.
std::vector< utils::SpatialVector > m_externalForces
 The vector that holds all the external forces.
LocalForcesInternal m_externalForcesInLocal
std::vector< std::pair< utils::Vector3d, rigidbody::NodeSegment > > m_translationalForces

Detailed Description

An External force set that can apply forces to the model while computing the dynamics.

Definition at line 31 of file ExternalForceSet.h.

Constructor & Destructor Documentation

◆ ExternalForceSet()

rigidbody::ExternalForceSet::ExternalForceSet ( Model & model,
bool useTranslationalForces = true,
bool useSoftContacts = true )

Construct ExternalForceSet.

Parameters
modelThe model onto which the external forces will be applied on. This is used in conjunction with segmentName (when using set) to determine at which index the set vector is positioned in the internal Set.
useTranslationalForcesIf this force set has external forces
useSoftContactsIf this force set has soft contacts

Definition at line 22 of file ExternalForceSet.cpp.

◆ ~ExternalForceSet()

rigidbody::ExternalForceSet::~ExternalForceSet ( )

Delete the set and free the ressources.

Definition at line 37 of file ExternalForceSet.cpp.

Member Function Documentation

◆ add() [1/2]

void rigidbody::ExternalForceSet::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 acting on segmentName, applied at origin and expressed in the global reference frame. method offered by ExternalForceSet below.

Parameters
segmentNameThe name of the segment to apply the spatial vector on.
vectorThe SpatialVector to add to the set.

Definition at line 39 of file ExternalForceSet.cpp.

◆ add() [2/2]

void rigidbody::ExternalForceSet::add ( 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 acting on segmentName, applied at pointOfApplication and expressed in the global reference frame.

Parameters
segmentNameThe name of the segment to apply the spatial vector on.
vectorThe SpatialVector to add to the set.
pointOfApplicationWhere the v vector is currenlty applied.

Definition at line 49 of file ExternalForceSet.cpp.

◆ addInSegmentReferenceFrame()

void rigidbody::ExternalForceSet::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 acting on segmentName, applied at pointOfApplication and expressed in the segment reference frame.

Parameters
segmentNameThe name of the segment to apply the spatial vector on.
vectorThe SpatialVector to add to the set.
pointOfApplicationWhere the v vector is currenlty applied in the segment reference frame.

Definition at line 60 of file ExternalForceSet.cpp.

◆ addTranslationalForce() [1/2]

void rigidbody::ExternalForceSet::addTranslationalForce ( const utils::Vector3d & force,
const rigidbody::NodeSegment & pointOfApplication )

Add a pure force at a specific point on the kinematic chain.

Parameters
forceThe pure forces to apply on the body
pointOfApplicationThe position of the force in reference frame of the node. Note that the [parentName] of must have been set

Definition at line 82 of file ExternalForceSet.cpp.

◆ addTranslationalForce() [2/2]

void rigidbody::ExternalForceSet::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.

Parameters
forceInGlobalThe pure forces to apply on the body
segmentNameThe name of the segment the force is applied on
pointOfApplicationInLocalThe position in the reference frame of [segmentName]

Definition at line 72 of file ExternalForceSet.cpp.

◆ combineLocalReferenceFrameForces()

void rigidbody::ExternalForceSet::combineLocalReferenceFrameForces ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
std::vector< utils::SpatialVector > & out )
protected

Add the forces expressed in the local reference to the internal Set.

Parameters
updatedModelThe joint model that with its kinematics updated
QThe Generalized coordinates.
outThe vector of SpatialVector to fill

Note: as this is an internal method, even though Q is passed, it is assumed update kinematics was already done.

Definition at line 214 of file ExternalForceSet.cpp.

◆ combineSoftContactForces()

void rigidbody::ExternalForceSet::combineSoftContactForces ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot,
std::vector< utils::SpatialVector > & out ) const
protected

Add the soft contact forces to the internal Set.

Parameters
updatedModelThe joint model that with its kinematics updated
QThe Generalized coordinates.
QdotThe Generalized velocity.
outThe vector of SpatialVector to fill

Note: as this is an internal method, even though Q is passed, it is assumed update kinematics was already done.

Definition at line 302 of file ExternalForceSet.cpp.

◆ combineTranslationalForces()

void rigidbody::ExternalForceSet::combineTranslationalForces ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
std::vector< utils::SpatialVector > & out ) const
protected

Add the translational forces to the internal Set.

Parameters
updatedModelThe joint model that with its kinematics updated
QThe Generalized coordinates.
outThe vector of SpatialVector to fill

Note: as this is an internal method, even though Q is passed, it is assumed update kinematics was already done.

Definition at line 268 of file ExternalForceSet.cpp.

◆ computeRbdlSpatialVectors() [1/3]

std::vector< RigidBodyDynamics::Math::SpatialVector > rigidbody::ExternalForceSet::computeRbdlSpatialVectors ( rigidbody::Joints & updatedModel)

The forces in a rbdl compatible format. This won't work if useTranslationalForces or useSoftContacts is set to true.

Parameters
updatedModelThe joint model that with its kinematics updated
Returns
The external forces in a rbdl compatible format

Definition at line 93 of file ExternalForceSet.cpp.

◆ computeRbdlSpatialVectors() [2/3]

std::vector< RigidBodyDynamics::Math::SpatialVector > rigidbody::ExternalForceSet::computeRbdlSpatialVectors ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q )

The forces in a rbdl compatible format. This won't work if useSoftContacts is set to true.

Parameters
updatedModelThe joint model that with its kinematics updated
QThe generalized coordinates
Returns
The external forces in a rbdl compatible format

Definition at line 114 of file ExternalForceSet.cpp.

◆ computeRbdlSpatialVectors() [3/3]

std::vector< RigidBodyDynamics::Math::SpatialVector > rigidbody::ExternalForceSet::computeRbdlSpatialVectors ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot )

The forces in a rbdl compatible format.

Parameters
updatedModelThe joint model that with its kinematics updated
QThe generalized coordinates
QdotThe generalized velocity
Returns
The external forces in a rbdl compatible format

Definition at line 125 of file ExternalForceSet.cpp.

◆ computeSpatialVectors() [1/3]

std::vector< utils::SpatialVector > rigidbody::ExternalForceSet::computeSpatialVectors ( rigidbody::Joints & updatedModel)

The forces in a rbdl compatible format. This won't work if useTranslationalForces or useSoftContacts is set to true.

Parameters
updatedModelThe joint model that with its kinematics updated
Returns
The external forces as spatial vectors

Definition at line 139 of file ExternalForceSet.cpp.

◆ computeSpatialVectors() [2/3]

std::vector< utils::SpatialVector > rigidbody::ExternalForceSet::computeSpatialVectors ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q )

The forces in a rbdl compatible format. This won't work if useSoftContacts is set to true.

Parameters
updatedModelThe joint model that with its kinematics updated
QThe generalized coordinates
Returns
The external forces as spatial vectors

Definition at line 160 of file ExternalForceSet.cpp.

◆ computeSpatialVectors() [3/3]

std::vector< utils::SpatialVector > rigidbody::ExternalForceSet::computeSpatialVectors ( rigidbody::Joints & updatedModel,
const rigidbody::GeneralizedCoordinates & Q,
const rigidbody::GeneralizedVelocity & Qdot )

The forces in a rbdl compatible format.

Parameters
updatedModelThe joint model that with its kinematics updated
QThe generalized coordinates
QdotThe generalized velocity
Returns
The external forces as spatial vectors

Definition at line 171 of file ExternalForceSet.cpp.

◆ hasExternalForceInLocalReferenceFrame()

bool rigidbody::ExternalForceSet::hasExternalForceInLocalReferenceFrame ( ) const

Return if there is at least one external force expressed in the local reference frame. This is important since having this forces to send Q when computing the force in global reference frame.

Returns
If there is at least one external force in the local reference frame

Definition at line 188 of file ExternalForceSet.cpp.

◆ setZero()

void rigidbody::ExternalForceSet::setZero ( )

Initialize and zero out all the spatial vectors of the Set. Note this should always be called before reusing an ExternalForceSet unless one is absolutely sure that all the spatial vectors of the Set is in an expected state (that is, all the vectors were either set or zeroed).

Definition at line 193 of file ExternalForceSet.cpp.

◆ transportAtOrigin()

utils::SpatialVector rigidbody::ExternalForceSet::transportAtOrigin ( const utils::SpatialVector & v,
const rigidbody::NodeSegment & pointOfApplication ) const
protected

Get the rigid contacts in a list of spatial vector of dimension 6xNdof.

Parameters
vThe spatial vector to transport
pointOfApplicationThe position where the force is applied in base coordinate
Returns
The effect of the force when transported at origin

Definition at line 344 of file ExternalForceSet.cpp.

◆ transportForceAtOrigin()

utils::SpatialVector rigidbody::ExternalForceSet::transportForceAtOrigin ( const utils::Vector3d & force,
const rigidbody::NodeSegment & pointOfApplication ) const
protected

Get the rigid contacts in a list of spatial vector of dimension 6xNdof.

Parameters
forceThe force amplitude applied at the point
pointOfApplicationThe position where the force is applied in base coordinate
Returns
The effect of the force when transported at origin

Definition at line 322 of file ExternalForceSet.cpp.

Member Data Documentation

◆ m_externalForces

std::vector<utils::SpatialVector> BIORBD_NAMESPACE::rigidbody::ExternalForceSet::m_externalForces
protected

The vector that holds all the external forces.

Definition at line 323 of file ExternalForceSet.h.

◆ m_externalForcesInLocal

LocalForcesInternal BIORBD_NAMESPACE::rigidbody::ExternalForceSet::m_externalForcesInLocal
protected

The vector that holds all the external forces that are expressed in local reference frame (must call Q).

Definition at line 326 of file ExternalForceSet.h.

◆ m_model

Model& BIORBD_NAMESPACE::rigidbody::ExternalForceSet::m_model
protected

A reference to the kinematic model.

Definition at line 317 of file ExternalForceSet.h.

◆ m_translationalForces

std::vector<std::pair<utils::Vector3d, rigidbody::NodeSegment> > BIORBD_NAMESPACE::rigidbody::ExternalForceSet::m_translationalForces
protected

The translational forces. The first is the amplitude and the second is the application point (that include the name of the parentSegment it is applied on)

Definition at line 331 of file ExternalForceSet.h.

◆ m_useSoftContacts

bool BIORBD_NAMESPACE::rigidbody::ExternalForceSet::m_useSoftContacts
protected

If soft contacts should be included.

Definition at line 320 of file ExternalForceSet.h.

◆ m_useTranslationalForces

bool BIORBD_NAMESPACE::rigidbody::ExternalForceSet::m_useTranslationalForces
protected

If translational forces should be included.

Definition at line 319 of file ExternalForceSet.h.


The documentation for this class was generated from the following files: