Drake
RigidBodySystem Class Reference

Implements the System concept by wrapping the RigidBodyTree algorithms with additional sensors and actuators/forces. More...

#include <drake/systems/plants/RigidBodySystem.h>

Collaboration diagram for RigidBodySystem:

Public Types

template<typename ScalarType >
using InputVector = Eigen::Matrix< ScalarType, Eigen::Dynamic, 1 >
 
template<typename ScalarType >
using StateVector = Eigen::Matrix< ScalarType, Eigen::Dynamic, 1 >
 
template<typename ScalarType >
using OutputVector = Eigen::Matrix< ScalarType, Eigen::Dynamic, 1 >
 

Public Member Functions

 RigidBodySystem (std::shared_ptr< RigidBodyTree > rigid_body_tree)
 
 RigidBodySystem ()
 
virtual ~RigidBodySystem ()
 
void addRobotFromURDFString (const std::string &xml_string, const std::string &root_dir=".", const DrakeJoint::FloatingBaseType floating_base_type=DrakeJoint::ROLLPITCHYAW)
 
void addRobotFromURDF (const std::string &urdf_filename, const DrakeJoint::FloatingBaseType floating_base_type=DrakeJoint::QUATERNION, std::shared_ptr< RigidBodyFrame > weld_to_frame=nullptr)
 
void addRobotFromSDF (const std::string &sdf_filename, const DrakeJoint::FloatingBaseType floating_base_type=DrakeJoint::QUATERNION, std::shared_ptr< RigidBodyFrame > weld_to_frame=nullptr)
 Adds the models contained within an SDF file to this rigid body system. More...
 
void addRobotFromFile (const std::string &filename, const DrakeJoint::FloatingBaseType floating_base_type=DrakeJoint::QUATERNION, std::shared_ptr< RigidBodyFrame > weld_to_frame=nullptr)
 
void addForceElement (std::shared_ptr< RigidBodyForceElement > f)
 
void addSensor (std::shared_ptr< RigidBodySensor > s)
 
const std::shared_ptr< RigidBodyTree > & getRigidBodyTree (void) const
 
size_t getNumStates () const
 
size_t getNumInputs () const
 
size_t getNumOutputs () const
 
int number_of_positions () const
 An accessor to the number of position states outputted by this rigid body system. More...
 
int number_of_velocities () const
 An accessor to the number of velocity states outputted by this rigid body system. More...
 
StateVector< doubledynamics (const double &t, const StateVector< double > &x, const InputVector< double > &u) const
 dynamics Formulates the forward dynamics of the rigid body system as an optimization find vdot, f (feasibility problem ok for now => implicit objective is min norm solution) subject to position equality constraints (differentiated twice + stabilization): A vdot = b velocity equality constraints (differentiated once + stabilization): A vdot = b forces from joint limits and contact OR contact force constraints on vdot, f. More...
 
OutputVector< doubleoutput (const double &t, const StateVector< double > &x, const InputVector< double > &u) const
 
bool isTimeVarying () const
 
bool isDirectFeedthrough () const
 
std::vector< const RigidBodySensor * > GetSensors () const
 An accessor to the sensors within this rigid body system. More...
 

Public Attributes

bool use_multi_contact
 
double penetration_stiffness
 
double penetration_damping
 
double friction_coefficient
 

Friends

DRAKERBSYSTEM_EXPORT StateVector< doublegetInitialState (const RigidBodySystem &sys)
 

Detailed Description

Implements the System concept by wrapping the RigidBodyTree algorithms with additional sensors and actuators/forces.

Implements the System concept where state is both joint position and velocity.

Implemented concepts:
System Concept

Member Typedef Documentation

using InputVector = Eigen::Matrix<ScalarType, Eigen::Dynamic, 1>
using OutputVector = Eigen::Matrix<ScalarType, Eigen::Dynamic, 1>
using StateVector = Eigen::Matrix<ScalarType, Eigen::Dynamic, 1>

Constructor & Destructor Documentation

RigidBodySystem ( std::shared_ptr< RigidBodyTree rigid_body_tree)
inlineexplicit
RigidBodySystem ( )
inline
virtual ~RigidBodySystem ( )
inlinevirtual

Member Function Documentation

void addForceElement ( std::shared_ptr< RigidBodyForceElement f)
inline

Here is the caller graph for this function:

void addRobotFromFile ( const std::string &  filename,
const DrakeJoint::FloatingBaseType  floating_base_type = DrakeJoint::QUATERNION,
std::shared_ptr< RigidBodyFrame weld_to_frame = nullptr 
)
void addRobotFromSDF ( const std::string &  sdf_filename,
const DrakeJoint::FloatingBaseType  floating_base_type = DrakeJoint::QUATERNION,
std::shared_ptr< RigidBodyFrame weld_to_frame = nullptr 
)

Adds the models contained within an SDF file to this rigid body system.

The models within a particular SDF file can be added multiple times. Each model is uniquely identified by a model ID that is assigned to the rigid bodies that belong to the model.

Parameters
[in]sdf_filenameThe name of the SDF file containing the models to add to this rigid body system.
[in]floating_base_typeThe type of floating base to use to connect the models within the SDF file to the world.
[in]weld_to_frameThe frame used for connecting the models in the SDF to the rigid body tree within this rigid body system. Note that this specifies both the existing frame in the rigid body tree to connect the new models to and the offset from this frame to the new models' root bodies. This is an optional parameter. If it is nullptr, the models within the SDF are connected to the world with zero offset and rotation relative to the world's frame.

Here is the call graph for this function:

void addRobotFromURDF ( const std::string &  urdf_filename,
const DrakeJoint::FloatingBaseType  floating_base_type = DrakeJoint::QUATERNION,
std::shared_ptr< RigidBodyFrame weld_to_frame = nullptr 
)

Here is the call graph for this function:

void addRobotFromURDFString ( const std::string &  xml_string,
const std::string &  root_dir = ".",
const DrakeJoint::FloatingBaseType  floating_base_type = DrakeJoint::ROLLPITCHYAW 
)

Here is the call graph for this function:

void addSensor ( std::shared_ptr< RigidBodySensor s)

Here is the caller graph for this function:

RigidBodySystem::StateVector< double > dynamics ( const double t,
const StateVector< double > &  x,
const InputVector< double > &  u 
) const

dynamics Formulates the forward dynamics of the rigid body system as an optimization find vdot, f (feasibility problem ok for now => implicit objective is min norm solution) subject to position equality constraints (differentiated twice + stabilization): A vdot = b velocity equality constraints (differentiated once + stabilization): A vdot = b forces from joint limits and contact OR contact force constraints on vdot, f.

can be linear, nonlinear, even complementarity. may have inequalities the trick is that each new constraint can add decision variables (the new constraint forces and/or slack variables) to the problem, so the last constraint to add is equations of motion: H vdot + C(q, qdot, u, f_ext) = J^T(q, qdot) f where J is accumulated through the constraint logic

The solver will then dispatch to the right tool for the job. Note that for many systems, especially those without any contact constraints (or with simple friction models), the formulation is linear and can be solved with least-squares.

Here is the call graph for this function:

Here is the caller graph for this function:

size_t getNumInputs ( void  ) const

Here is the caller graph for this function:

size_t getNumOutputs ( ) const

Here is the call graph for this function:

Here is the caller graph for this function:

size_t getNumStates ( ) const

Here is the caller graph for this function:

const std::shared_ptr<RigidBodyTree>& getRigidBodyTree ( void  ) const
inline

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< const RigidBodySensor * > GetSensors ( ) const

An accessor to the sensors within this rigid body system.

This is useful for downstream components to understand the meaning of the output signal of this system.

Returns
a const reference to the sensors vector within this rigid body system.
bool isDirectFeedthrough ( ) const
inline

Here is the call graph for this function:

bool isTimeVarying ( ) const
inline
int number_of_positions ( ) const

An accessor to the number of position states outputted by this rigid body system.

int number_of_velocities ( ) const

An accessor to the number of velocity states outputted by this rigid body system.

RigidBodySystem::OutputVector< double > output ( const double t,
const StateVector< double > &  x,
const InputVector< double > &  u 
) const

Here is the call graph for this function:

Friends And Related Function Documentation

DRAKERBSYSTEM_EXPORT StateVector<double> getInitialState ( const RigidBodySystem sys)
friend

Member Data Documentation

double friction_coefficient
double penetration_damping
double penetration_stiffness
bool use_multi_contact

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