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, double &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 double CalcPotentialEnergy (Model &model, const Math::VectorNd &q, bool update_kinematics=true)
 Computes the potential energy of the full model. More...
 
RBDL_DLLAPI double 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,
double &  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 153 of file rbdl_utils.cc.

References Model::a, SpatialTransform::applyAdjoint(), RigidBodyDynamics::Math::crossf(), SpatialRigidBodyInertia::h, Model::hc, Model::hdotc, Model::I, Model::Ic, Model::lambda, LOG, SpatialRigidBodyInertia::m, Model::mBodies, Vector3_t::set(), RigidBodyDynamics::UpdateKinematicsCustom(), Model::v, Model::X_lambda, and RigidBodyDynamics::Math::Xtrans().

◆ CalcKineticEnergy()

RBDL_DLLAPI double 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 337 of file rbdl_utils.cc.

References Model::I, Model::mBodies, RigidBodyDynamics::UpdateKinematicsCustom(), and Model::v.

◆ CalcPotentialEnergy()

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

Computes the potential energy of the full model.

Definition at line 312 of file rbdl_utils.cc.

References CalcCenterOfMass(), Model::gravity, LOG, and Model::qdot_size.

◆ 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 236 of file rbdl_utils.cc.

References Model::a, SpatialTransform::applyAdjoint(), RigidBodyDynamics::Math::crossf(), Model::gravity, SpatialRigidBodyInertia::h, Model::hc, Model::hdotc, Model::I, Model::Ic, SpatialTransform::inverse(), Model::lambda, SpatialRigidBodyInertia::m, Model::mBodies, RigidBodyDynamics::UpdateKinematicsCustom(), Model::v, Model::X_lambda, and RigidBodyDynamics::Math::Xtrans().

◆ get_body_name()

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

Definition at line 43 of file rbdl_utils.cc.

References Model::GetBodyName(), Model::mBodies, and Model::mu.

◆ get_dof_name()

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

Definition at line 24 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 55 of file rbdl_utils.cc.

References get_body_name(), get_dof_name(), Model::mBodies, Model::mJoints, and Model::S.

◆ GetModelHierarchy()

RBDL_DLLAPI std::string GetModelHierarchy ( const Model model)

Creates a human readable overview of the model.

Definition at line 125 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 133 of file rbdl_utils.cc.

References RigidBodyDynamics::CalcBodyToBaseCoordinates(), Model::dof_count, Model::GetBodyName(), Model::mBodies, and RigidBodyDynamics::UpdateKinematicsCustom().

◆ print_hierarchy()

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