Rigid Body Dynamics Library
RigidBodyDynamics::Utils Namespace Reference

Namespace that contains optional helper functions. More...

Functions

string get_dof_name (const SpatialVector &joint_dof)
 
string get_body_name (const RigidBodyDynamics::Model &model, unsigned int body_id)
 
RBDL_DLLAPI std::string GetModelDOFOverview (const Model &model)
 Creates a human readable overview of the Degrees of Freedom. More...
 
std::string print_hierarchy (const RigidBodyDynamics::Model &model, unsigned int body_index=0, int indent=0)
 
RBDL_DLLAPI std::string GetModelHierarchy (const Model &model)
 Creates a human readable overview of the model. More...
 
RBDL_DLLAPI std::string GetNamedBodyOriginsOverview (Model &model)
 Creates a human readable overview of the locations of all bodies that have names. More...
 
RBDL_DLLAPI void CalcCenterOfMass (Model &model, const Math::VectorNd &q, const Math::VectorNd &qdot, const Math::VectorNd *qddot, Math::Scalar &mass, Math::Vector3d &com, Math::Vector3d *com_velocity=NULL, Math::Vector3d *com_acceleration=NULL, Math::Vector3d *angular_momentum=NULL, Math::Vector3d *change_of_angular_momentum=NULL, bool update_kinematics=true)
 Computes the Center of Mass (COM) and optionally its linear velocity. More...
 
RBDL_DLLAPI void CalcZeroMomentPoint (Model &model, const Math::VectorNd &q, const Math::VectorNd &qdot, const Math::VectorNd &qddot, Math::Vector3d *zmp, const Math::Vector3d &normal=Math::Vector3d(0., 0., 1.), const Math::Vector3d &point=Math::Vector3d(0., 0., 0.), bool update_kinematics=true)
 Computes the Zero-Moment-Point (ZMP) on a given contact surface. More...
 
RBDL_DLLAPI Scalar CalcPotentialEnergy (Model &model, const Math::VectorNd &q, bool update_kinematics=true)
 Computes the potential energy of the full model. More...
 
RBDL_DLLAPI Scalar CalcKineticEnergy (Model &model, const Math::VectorNd &q, const Math::VectorNd &qdot, bool update_kinematics=true)
 Computes the kinetic energy of the full model. More...
 

Detailed Description

Namespace that contains optional helper functions.

Function Documentation

◆ CalcCenterOfMass()

RBDL_DLLAPI void CalcCenterOfMass ( Model &  model,
const Math::VectorNd q,
const Math::VectorNd qdot,
const Math::VectorNd qddot,
Math::Scalar mass,
Math::Vector3d com,
Math::Vector3d com_velocity = NULL,
Math::Vector3d com_acceleration = NULL,
Math::Vector3d angular_momentum = NULL,
Math::Vector3d change_of_angular_momentum = NULL,
bool  update_kinematics = true 
)

Computes the Center of Mass (COM) and optionally its linear velocity.

When only interested in computing the location of the COM you can use NULL as value for com_velocity.

Parameters
modelThe model for which we want to compute the COM
qThe current joint positions
qdotThe current joint velocities
mass(output) total mass of the model
com(output) location of the Center of Mass of the model in base coordinates
qddot(optional input) A pointer to the current joint accelerations
com_velocity(optional output) linear velocity of the COM in base coordinates
com_acceleration(optional output) linear acceleration of the COM in base coordinates
angular_momentum(optional output) angular momentum of the model at the COM in base coordinates
change_of_angular_momentum(optional output) change of angular momentum of the model at the COM in base coordinates
update_kinematics(optional input) whether the kinematics should be updated (defaults to true)
Note
When wanting to compute com_acceleration or change_of_angular momentum one has to provide qddot. In all other cases one can use NULL as argument for qddot.

Definition at line 190 of file rbdl_utils.cc.

References SpatialTransform::applyAdjoint(), RigidBodyDynamics::Math::crossf(), SpatialRigidBodyInertia::h, SpatialRigidBodyInertia::m, Vector3_t::set(), RigidBodyDynamics::UpdateKinematicsCustom(), and RigidBodyDynamics::Math::Xtrans().

◆ CalcKineticEnergy()

RBDL_DLLAPI Math::Scalar CalcKineticEnergy ( Model &  model,
const Math::VectorNd q,
const Math::VectorNd qdot,
bool  update_kinematics 
)

Computes the kinetic energy of the full model.

Definition at line 390 of file rbdl_utils.cc.

References RigidBodyDynamics::UpdateKinematicsCustom().

◆ CalcPotentialEnergy()

RBDL_DLLAPI Math::Scalar CalcPotentialEnergy ( Model &  model,
const Math::VectorNd q,
bool  update_kinematics 
)

Computes the potential energy of the full model.

Definition at line 363 of file rbdl_utils.cc.

References CalcCenterOfMass(), and MX_Xd_dynamic::Zero().

◆ CalcZeroMomentPoint()

RBDL_DLLAPI void CalcZeroMomentPoint ( Model &  model,
const Math::VectorNd q,
const Math::VectorNd qdot,
const Math::VectorNd qddot,
Math::Vector3d zmp,
const Math::Vector3d normal = Math::Vector3d(0., 0., 1.),
const Math::Vector3d point = Math::Vector3d(0., 0., 0.),
bool  update_kinematics = true 
)

Computes the Zero-Moment-Point (ZMP) on a given contact surface.

Parameters
modelThe model for which we want to compute the ZMP
qThe current joint positions
qdotThe current joint velocities
qdotThe current joint accelerations
normalThe normal of the respective contact surface
pointA point on the contact surface
zmp(output) location of the Zero-Moment-Point of the model in base coordinates projected on the given contact surface
update_kinematics(optional input) whether the kinematics should be updated (defaults to true)

Definition at line 282 of file rbdl_utils.cc.

References SpatialTransform::applyAdjoint(), RigidBodyDynamics::Math::crossf(), SpatialRigidBodyInertia::h, SpatialTransform::inverse(), SpatialRigidBodyInertia::m, RigidBodyDynamics::UpdateKinematicsCustom(), and RigidBodyDynamics::Math::Xtrans().

◆ get_body_name()

string RigidBodyDynamics::Utils::get_body_name ( const RigidBodyDynamics::Model &  model,
unsigned int  body_id 
)

Definition at line 50 of file rbdl_utils.cc.

References get_body_name().

◆ get_dof_name()

string RigidBodyDynamics::Utils::get_dof_name ( const SpatialVector joint_dof)

Definition at line 28 of file rbdl_utils.cc.

◆ GetModelDOFOverview()

RBDL_DLLAPI std::string GetModelDOFOverview ( const Model &  model)

Creates a human readable overview of the Degrees of Freedom.

Definition at line 66 of file rbdl_utils.cc.

References get_body_name(), and get_dof_name().

◆ GetModelHierarchy()

RBDL_DLLAPI std::string GetModelHierarchy ( const Model &  model)

Creates a human readable overview of the model.

Definition at line 157 of file rbdl_utils.cc.

References print_hierarchy().

◆ GetNamedBodyOriginsOverview()

RBDL_DLLAPI std::string GetNamedBodyOriginsOverview ( Model &  model)

Creates a human readable overview of the locations of all bodies that have names.

Definition at line 167 of file rbdl_utils.cc.

References RigidBodyDynamics::CalcBodyToBaseCoordinates(), RigidBodyDynamics::UpdateKinematicsCustom(), and MX_Xd_dynamic::Zero().

◆ print_hierarchy()

std::string RigidBodyDynamics::Utils::print_hierarchy ( const RigidBodyDynamics::Model &  model,
unsigned int  body_index = 0,
int  indent = 0 
)

Definition at line 89 of file rbdl_utils.cc.

References get_body_name(), get_dof_name(), and print_hierarchy().