1#ifndef BIORBD_RIGIDBODY_CONTACTS_H
2#define BIORBD_RIGIDBODY_CONTACTS_H
4#include "biorbdConfig.h"
9#include <rbdl/Constraints.h>
11namespace BIORBD_NAMESPACE {
36class BIORBD_API
Contacts :
public RigidBodyDynamics::ConstraintSet
112 size_t body_id_predecessor,
113 size_t body_id_successor,
118 bool enableStabilization =
false,
119 double stabilizationParam = 0.1);
290 bool updateKin =
true);
302 bool updateKin =
true);
318 bool updateKin =
true);
332 bool updateKin =
true);
356 bool updateKin =
true);
378 bool updateKin =
true);
392 std::shared_ptr<std::vector<rigidbody::NodeSegment>>
const std::vector< NodeSegment > & rigidContacts() const
Returns all the rigid contacts as declared in the model.
utils::Vector3d rigidContactVelocity(const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, size_t idx, bool updateKin=true)
Return the velocity of the chosen contact.
std::shared_ptr< std::vector< rigidbody::NodeSegment > > m_rigidContacts
std::vector< utils::String > contactNames()
Return the name of the all contacts.
std::shared_ptr< size_t > m_nbreConstraint
Number of constraints.
utils::Matrix rigidContactJacobian(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q, size_t idx)
Compute the Jacobian of a single rigid contact.
size_t nbLoopConstraints() const
Return the number of loop constraints.
int contactSegmentBiorbdId(int idx) const
Return the segment idx of the contact in biorbd formalism.
static utils::Matrix projectContactJacobian(const utils::Matrix &J, const rigidbody::NodeSegment &contact)
Project a 3D point Jacobian onto active contact axes.
std::shared_ptr< size_t > m_nbLoopConstraint
Number of constraints.
size_t contactRbdlId(const utils::String &name)
Return the index of the contact corresponding to the given name.
utils::Vector getForce() const
Return the force acting on the constraint.
bool hasContacts() const
Check if there are contacts.
Contacts DeepCopy() const
Deep copy of contacts.
Contacts & getConstraints()
Get constraints.
bool hasLoopConstraints() const
Check if there are loop constraints.
utils::Vector3d rigidContactAcceleration(const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, const rigidbody::GeneralizedAcceleration &dQdot, size_t idx, bool updateKin=true)
Return the acceleration of the chosen contact.
std::vector< utils::Vector3d > rigidContactsAcceleration(const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, const rigidbody::GeneralizedAcceleration &dQdot, bool updateKin=true)
Return the acceleration of all the contacts.
size_t AddLoopConstraint(size_t body_id_predecessor, size_t body_id_successor, const utils::RotoTrans &X_predecessor, const utils::RotoTrans &X_successor, const utils::SpatialVector &axis, const utils::String &name, bool enableStabilization=false, double stabilizationParam=0.1)
Add a loop constraint to the constraint set.
size_t nbContacts() const
Return the number of contacts.
std::vector< utils::Vector3d > rigidContactsVelocity(const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, bool updateKin=true)
Return the velocities of all the contacts.
utils::String swapAxes(const utils::String &axesToSwap) const
Swap the status of the axes provided, that is adding x, y or z if it is not there and remove them oth...
size_t AddConstraint(size_t bodyId, const utils::Vector3d &bodyPoint, const utils::Vector3d &worldNormal, const utils::String &name, const utils::String &parentName)
Add a constraint to the constraint set.
const NodeSegment & rigidContact(size_t idx) const
Returns the rigid contact idx as declared in the model.
std::vector< size_t > segmentRigidContactIdx(int segment_idx) const
Return the index of rigid contacts for a specified segment index.
std::vector< utils::Matrix > rigidContactsJacobian(rigidbody::Joints &updatedModel, const rigidbody::GeneralizedCoordinates &Q)
Compute the Jacobians of all rigid contacts.
std::shared_ptr< bool > m_isBinded
If the model is ready.
utils::String contactName(size_t i)
Return the name of the contact of a specified axis.
std::vector< utils::SpatialVector > calcLoopConstraintForces(const rigidbody::GeneralizedCoordinates &Q, const rigidbody::GeneralizedVelocity &Qdot, const rigidbody::GeneralizedTorque &Tau)
compute the forces generated from loop constraints
Contacts()
Construct contacts.
int nbRigidContacts() const
Returns the number of rigid contacts (ignoring the loop constraints).
std::vector< utils::Vector3d > constraintsInGlobal(const GeneralizedCoordinates &Q, bool updateKin)
Return the constraints position in the global reference.
An External force set that can apply forces to the model while computing the dynamics.
Class GeneralizedAcceleration.
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.
A wrapper for the Eigen::MatrixXd.
Homogenous matrix to describe translations and rotations simultaneously.
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.
Wrapper of the Eigen VectorXd.