Rigid Body Dynamics Library
RigidBodyDynamics Namespace Reference

Namespace for all structures of the RigidBodyDynamics library. More...

Namespaces

 Addons
 
 Math
 Math types such as vectors and matrices and utility functions.
 
 Utils
 Namespace that contains optional helper functions.
 

Data Structures

struct  Body
 Describes all properties of a single body. More...
 
struct  ConstraintSet
 Structure that contains both constraint information and workspace memory. More...
 
struct  CustomJoint
 
struct  FixedBody
 Keeps the information of a body and how it is attached to another body. More...
 
struct  Joint
 Describes a joint relative to the predecessor body. More...
 
struct  Model
 Contains all information about the rigid body model. More...
 

Enumerations

enum  JointType {
  JointTypeUndefined = 0, JointTypeRevolute, JointTypePrismatic,
  JointTypeRevoluteX, JointTypeRevoluteY, JointTypeRevoluteZ,
  JointTypeSpherical, JointTypeEulerZYX, JointTypeEulerXYZ,
  JointTypeEulerYXZ, JointTypeTranslationXYZ, JointTypeFloatingBase,
  JointTypeFixed, JointType1DoF, JointType2DoF,
  JointType3DoF, JointType4DoF, JointType5DoF,
  JointType6DoF, JointTypeCustom
}
 General types of joints. More...
 

Functions

RBDL_DLLAPI void SolveContactSystemDirect (Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &A, Math::VectorNd &b, Math::VectorNd &x, Math::LinearSolver &linear_solver)
 Solves the full contact system directly, i.e. simultaneously for contact forces and joint accelerations. More...
 
RBDL_DLLAPI void SolveContactSystemRangeSpaceSparse (Model &model, Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &K, Math::VectorNd &a, Math::LinearSolver linear_solver)
 Solves the contact system by first solving for the the joint accelerations and then the contact forces using a sparse matrix decomposition of the joint space inertia matrix. More...
 
RBDL_DLLAPI void SolveContactSystemNullSpace (Math::MatrixNd &H, const Math::MatrixNd &G, const Math::VectorNd &c, const Math::VectorNd &gamma, Math::VectorNd &qddot, Math::VectorNd &lambda, Math::MatrixNd &Y, Math::MatrixNd &Z, Math::VectorNd &qddot_y, Math::VectorNd &qddot_z, Math::LinearSolver &linear_solver)
 Solves the contact system by first solving for the joint accelerations and then for the constraint forces. More...
 
RBDL_DLLAPI void CalcContactJacobian (Model &model, const Math::VectorNd &Q, const ConstraintSet &CS, Math::MatrixNd &G, bool update_kinematics=true)
 Computes the Jacobian for the given ConstraintSet. More...
 
RBDL_DLLAPI void CalcContactSystemVariables (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS)
 
RBDL_DLLAPI void ForwardDynamicsContactsDirect (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot)
 Computes forward dynamics with contact by constructing and solving the full lagrangian equation. More...
 
RBDL_DLLAPI void ForwardDynamicsContactsRangeSpaceSparse (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot)
 
RBDL_DLLAPI void ForwardDynamicsContactsNullSpace (Model &model, const VectorNd &Q, const VectorNd &QDot, const VectorNd &Tau, ConstraintSet &CS, VectorNd &QDDot)
 
RBDL_DLLAPI void ComputeContactImpulsesDirect (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
 Computes contact gain by constructing and solving the full lagrangian equation. More...
 
RBDL_DLLAPI void ComputeContactImpulsesRangeSpaceSparse (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
 Resolves contact gain using SolveContactSystemRangeSpaceSparse() More...
 
RBDL_DLLAPI void ComputeContactImpulsesNullSpace (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDotMinus, ConstraintSet &CS, Math::VectorNd &QDotPlus)
 Resolves contact gain using SolveContactSystemNullSpace() More...
 
RBDL_DLLAPI void ForwardDynamicsApplyConstraintForces (Model &model, const VectorNd &Tau, ConstraintSet &CS, VectorNd &QDDot)
 Compute only the effects of external forces on the generalized accelerations. More...
 
RBDL_DLLAPI void ForwardDynamicsAccelerationDeltas (Model &model, ConstraintSet &CS, VectorNd &QDDot_t, const unsigned int body_id, const std::vector< SpatialVector > &f_t)
 Computes the effect of external forces on the generalized accelerations. More...
 
void set_zero (std::vector< SpatialVector > &spatial_values)
 
RBDL_DLLAPI void ForwardDynamicsContactsKokkevis (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, ConstraintSet &CS, Math::VectorNd &QDDot)
 Computes forward dynamics that accounts for active contacts in ConstraintSet. More...
 
RBDL_DLLAPI void InverseDynamics (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &QDDot, Math::VectorNd &Tau, std::vector< Math::SpatialVector > *f_ext=NULL)
 Computes inverse dynamics with the Newton-Euler Algorithm. More...
 
RBDL_DLLAPI void NonlinearEffects (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, Math::VectorNd &Tau)
 Computes the coriolis forces. More...
 
RBDL_DLLAPI void CompositeRigidBodyAlgorithm (Model &model, const Math::VectorNd &Q, Math::MatrixNd &H, bool update_kinematics=true)
 Computes the joint space inertia matrix by using the Composite Rigid Body Algorithm. More...
 
RBDL_DLLAPI void ForwardDynamics (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, Math::VectorNd &QDDot, std::vector< Math::SpatialVector > *f_ext=NULL)
 Computes forward dynamics with the Articulated Body Algorithm. More...
 
RBDL_DLLAPI void ForwardDynamicsLagrangian (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &Tau, Math::VectorNd &QDDot, Math::LinearSolver linear_solver=Math::LinearSolverColPivHouseholderQR, std::vector< Math::SpatialVector > *f_ext=NULL, Math::MatrixNd *H=NULL, Math::VectorNd *C=NULL)
 Computes forward dynamics by building and solving the full Lagrangian equation. More...
 
RBDL_DLLAPI void CalcMInvTimesTau (Model &model, const Math::VectorNd &Q, const Math::VectorNd &Tau, Math::VectorNd &QDDot, bool update_kinematics=true)
 Computes the effect of multiplying the inverse of the joint space inertia matrix with a vector in linear time. More...
 
RBDL_DLLAPI void jcalc (Model &model, unsigned int joint_id, const Math::VectorNd &q, const Math::VectorNd &qdot)
 Computes all variables for a joint model. More...
 
RBDL_DLLAPI Math::SpatialTransform jcalc_XJ (Model &model, unsigned int joint_id, const Math::VectorNd &q)
 
RBDL_DLLAPI void jcalc_X_lambda_S (Model &model, unsigned int joint_id, const VectorNd &q)
 
RBDL_DLLAPI void UpdateKinematics (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &QDDot)
 Updates and computes velocities and accelerations of the bodies. More...
 
RBDL_DLLAPI void UpdateKinematicsCustom (Model &model, const Math::VectorNd *Q, const Math::VectorNd *QDot, const Math::VectorNd *QDDot)
 Selectively updates model internal states of body positions, velocities and/or accelerations. More...
 
RBDL_DLLAPI Vector3d CalcBodyToBaseCoordinates (Model &model, const Math::VectorNd &Q, unsigned int body_id, const Math::Vector3d &body_point_position, bool update_kinematics=true)
 Returns the base coordinates of a point given in body coordinates. More...
 
RBDL_DLLAPI Vector3d CalcBaseToBodyCoordinates (Model &model, const Math::VectorNd &Q, unsigned int body_id, const Math::Vector3d &base_point_position, bool update_kinematics=true)
 Returns the body coordinates of a point given in base coordinates. More...
 
RBDL_DLLAPI Matrix3d CalcBodyWorldOrientation (Model &model, const Math::VectorNd &Q, const unsigned int body_id, bool update_kinematics=true)
 Returns the orientation of a given body as 3x3 matrix. More...
 
RBDL_DLLAPI void CalcPointJacobian (Model &model, const Math::VectorNd &Q, unsigned int body_id, const Math::Vector3d &point_position, Math::MatrixNd &G, bool update_kinematics=true)
 Computes the point jacobian for a point on a body. More...
 
RBDL_DLLAPI void CalcPointJacobian6D (Model &model, const Math::VectorNd &Q, unsigned int body_id, const Math::Vector3d &point_position, Math::MatrixNd &G, bool update_kinematics=true)
 Computes a 6-D Jacobian for a point on a body. More...
 
RBDL_DLLAPI void CalcBodySpatialJacobian (Model &model, const Math::VectorNd &Q, unsigned int body_id, Math::MatrixNd &G, bool update_kinematics=true)
 Computes the spatial jacobian for a body. More...
 
RBDL_DLLAPI Vector3d CalcPointVelocity (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
 Computes the velocity of a point on a body. More...
 
RBDL_DLLAPI Math::SpatialVector CalcPointVelocity6D (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
 Computes angular and linear velocity of a point that is fixed on a body. More...
 
RBDL_DLLAPI Vector3d CalcPointAcceleration (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &QDDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
 Computes the linear acceleration of a point on a body. More...
 
RBDL_DLLAPI SpatialVector CalcPointAcceleration6D (Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, const Math::VectorNd &QDDot, unsigned int body_id, const Math::Vector3d &point_position, bool update_kinematics=true)
 Computes linear and angular acceleration of a point on a body. More...
 
RBDL_DLLAPI bool InverseKinematics (Model &model, const Math::VectorNd &Qinit, const std::vector< unsigned int > &body_id, const std::vector< Math::Vector3d > &body_point, const std::vector< Math::Vector3d > &target_pos, Math::VectorNd &Qres, double step_tol=1.0e-12, double lambda=0.01, unsigned int max_iter=50)
 Computes the inverse kinematics iteratively using a damped Levenberg-Marquardt method (also known as Damped Least Squares method) More...
 

Detailed Description

Namespace for all structures of the RigidBodyDynamics library.

Enumeration Type Documentation

enum JointType

General types of joints.

Enumerator
JointTypeUndefined 
JointTypeRevolute 
JointTypePrismatic 
JointTypeRevoluteX 
JointTypeRevoluteY 
JointTypeRevoluteZ 
JointTypeSpherical 

3 DoF joint using Quaternions for joint positional variables and angular velocity for joint velocity variables.

JointTypeEulerZYX 

3 DoF joint that uses Euler ZYX convention (faster than emulated multi DoF joints).

JointTypeEulerXYZ 

3 DoF joint that uses Euler XYZ convention (faster than emulated multi DoF joints).

JointTypeEulerYXZ 

3 DoF joint that uses Euler YXZ convention (faster than emulated multi DoF joints).

JointTypeTranslationXYZ 
JointTypeFloatingBase 

A 6-DoF joint for floating-base (or freeflyer) systems.

JointTypeFixed 

Fixed joint which causes the inertial properties to be merged with the parent body.

JointType1DoF 
JointType2DoF 

Emulated 2 DoF joint.

JointType3DoF 

Emulated 3 DoF joint.

JointType4DoF 

Emulated 4 DoF joint.

JointType5DoF 

Emulated 5 DoF joint.

JointType6DoF 

Emulated 6 DoF joint.

JointTypeCustom 

User defined joints of varying size.

Definition at line 179 of file Joint.h.

Function Documentation

RBDL_DLLAPI void RigidBodyDynamics::ForwardDynamicsAccelerationDeltas ( Model model,
ConstraintSet CS,
VectorNd QDDot_t,
const unsigned int  body_id,
const std::vector< SpatialVector > &  f_t 
)

Computes the effect of external forces on the generalized accelerations.

This function is essentially similar to ForwardDynamics() except that it tries to only perform computations of variables that change due to external forces defined in f_t.

Definition at line 702 of file Contacts.cc.

References Model::a, Model::d, ConstraintSet::d_a, ConstraintSet::d_multdof3_u, ConstraintSet::d_pA, ConstraintSet::d_u, JointTypeCustom, Model::lambda, LOG, Model::mBodies, Model::mCustomJoints, Model::mJoints, Model::multdof3_Dinv, Model::multdof3_S, Model::multdof3_U, Model::S, Model::U, Model::X_base, and Model::X_lambda.

RBDL_DLLAPI void RigidBodyDynamics::ForwardDynamicsApplyConstraintForces ( Model model,
const VectorNd Tau,
ConstraintSet CS,
VectorNd QDDot 
)

Compute only the effects of external forces on the generalized accelerations.

This function is a reduced version of ForwardDynamics() which only computes the effects of the external forces on the generalized accelerations.

Definition at line 530 of file Contacts.cc.

References Model::a, SpatialTransform::apply(), Model::c, RigidBodyDynamics::Math::crossf(), Model::d, Model::dof_count, ConstraintSet::f_ext_constraints, Model::gravity, Model::I, Model::IA, JointTypeCustom, Model::lambda, LOG, Model::mBodies, Model::mCustomJoints, Model::mJoints, Model::multdof3_Dinv, Model::multdof3_S, Model::multdof3_U, Model::multdof3_u, Model::pA, Model::S, RigidBodyDynamics::Math::SpatialVectorZero, Model::U, Model::u, Model::v, Model::X_base, and Model::X_lambda.

RBDL_DLLAPI void jcalc ( Model model,
unsigned int  joint_id,
const Math::VectorNd q,
const Math::VectorNd qdot 
)

Computes all variables for a joint model.

By appropriate modification of this function all types of joints can be modeled. See RBDA Section 4.4 for details.

Parameters
modelthe rigid body model
joint_idthe id of the joint we are interested in. This will be used to determine the type of joint and also the entries of

\[ q, \dot{q} \]

.
XJthe joint transformation (output)
v_Jjoint velocity (output)
c_Jjoint acceleration for rhenomic joints (output)
qjoint state variables
qdotjoint velocity variables

Definition at line 21 of file Joint.cc.

References Model::c_J, Joint::custom_joint_index, Model::GetQuaternion(), CustomJoint::jcalc(), jcalc_XJ(), JointTypeCustom, JointTypeEulerXYZ, JointTypeEulerYXZ, JointTypeEulerZYX, JointTypeRevoluteX, JointTypeRevoluteY, JointTypeRevoluteZ, JointTypeSpherical, JointTypeTranslationXYZ, Model::mCustomJoints, Model::mJoints, Model::multdof3_S, Model::S, Quaternion::toMatrix(), Model::v_J, Model::X_J, Model::X_lambda, Model::X_T, RigidBodyDynamics::Math::Xrotx(), RigidBodyDynamics::Math::Xroty(), and RigidBodyDynamics::Math::Xrotz().

RBDL_DLLAPI Math::SpatialTransform jcalc_XJ ( Model model,
unsigned int  joint_id,
const Math::VectorNd q 
)
void RigidBodyDynamics::set_zero ( std::vector< SpatialVector > &  spatial_values)
inline

Definition at line 830 of file Contacts.cc.