Drake
ParamSet Class Reference

A class for parsing and storing parameters that are used to generate QpInput for the inverse dynamics controller. More...

#include <drake/systems/controllers/qp_inverse_dynamics/param_parser.h>

Public Member Functions

 ParamSet ()
 
void LoadFromFile (const std::string &config_path, const RigidBodyTreeAliasGroups< double > &alias_group)
 Loads parameters from a config file for the inverse dynamics controller. More...
 
std::unordered_map< std::string, ContactInformationMakeContactInformation (const std::string &group_name, const RigidBodyTreeAliasGroups< double > &alias_group) const
 Returns a map from body names to ContactInformation, where the body names belong to the body group specified by group_name in alias_group. More...
 
std::unordered_map< std::string, DesiredBodyMotionMakeDesiredBodyMotion (const std::string &group_name, const RigidBodyTreeAliasGroups< double > &alias_group) const
 Returns a map from body names to DesiredBodyMotions, where the body names belongs to the body group specified by group_name in alias_group. More...
 
ContactInformation MakeContactInformation (const RigidBody< double > &body) const
 Returns a single ContactInformation for body. More...
 
DesiredBodyMotion MakeDesiredBodyMotion (const RigidBody< double > &body) const
 Returns a single DesiredBodyMotion for body. More...
 
void LookupDesiredBodyMotionGains (const std::string &group_name, const RigidBodyTreeAliasGroups< double > &alias_group, std::vector< Vector6< double >> *kp, std::vector< Vector6< double >> *kd) const
 Finds the kp and kd gains for all the bodies in the body group specified by group_name. More...
 
void LookupDesiredBodyMotionGains (const RigidBody< double > &body, Vector6< double > *kp, Vector6< double > *kd) const
 Finds the kp and kd gains for body. More...
 
void LookupDesiredDofMotionGains (VectorX< double > *kp, VectorX< double > *kd) const
 Obtains the kp and kd gains for all DoF. More...
 
void LookupDesiredCentroidalMomentumDotGains (Vector6< double > *kp, Vector6< double > *kd) const
 Obtains the kp and kd gains for the centroidal momentum tracker. More...
 
DesiredDofMotions MakeDesiredDofMotions () const
 Returns DesiredDofMotions configured by DesiredMotionParam for all DoF. More...
 
DesiredCentroidalMomentumDot MakeDesiredCentroidalMomentumDot () const
 Returns DesiredCentroidalMomentumDot configured by the DesiredMotionParam for centroidal momentum. More...
 
QpInput MakeQpInput (const std::vector< std::string > &contact_body_groups, const std::vector< std::string > &tracked_body_groups, const RigidBodyTreeAliasGroups< double > &alias_group) const
 Returns a QpInput for the given contacts and tracked bodies using the parameters held by this instance. More...
 
QpInput MakeQpInput (const std::vector< const RigidBody< double > * > &contact_bodies, const std::vector< const RigidBody< double > * > &tracked_bodies, const RigidBodyTreeAliasGroups< double > &alias_group) const
 Returns a QpInput for the given contacts and tracked bodies using the parameters held by this instance. More...
 
double get_basis_regularization_weight () const
 Returns the weight for regularizing the basis vectors of contact forces. More...
 
const std::string & get_name () const
 Returns the name of this ParamSet. More...
 
void set_name (const std::string &name)
 Sets the name of this ParamSet. More...
 
Does not allow copy, move, or assignment
 ParamSet (const ParamSet &)=delete
 
ParamSetoperator= (const ParamSet &)=delete
 
 ParamSet (ParamSet &&)=delete
 
ParamSetoperator= (ParamSet &&)=delete
 

Detailed Description

A class for parsing and storing parameters that are used to generate QpInput for the inverse dynamics controller.

Utility methods for generating ContactInformation, DesiredBodyMotion, DesiredDoFMotion and DesiredCentroidalMomentumDot from the stored parameters are also provided. DesiredBodyMotion, DesiredDoFMotion and DesiredCentroidalMomentumDot consist of two groups of numbers: gains / weights and desired acceleration. This class only works with the gains and weights. The second group needs to be computed by some feedback policy, which outside the scope of this class.

This class loads its configuration from text-format protocol buffers. Uninitialized fields will default to 0 for numerical values, and empty string for string values. It is highly recommended that all fields are specified when writing a config file.

Constructor & Destructor Documentation

ParamSet ( const ParamSet )
delete
ParamSet ( ParamSet &&  )
delete
ParamSet ( )
inline

Member Function Documentation

double get_basis_regularization_weight ( ) const
inline

Returns the weight for regularizing the basis vectors of contact forces.

Here is the caller graph for this function:

const std::string& get_name ( ) const
inline

Returns the name of this ParamSet.

void LoadFromFile ( const std::string &  config_path,
const RigidBodyTreeAliasGroups< double > &  alias_group 
)

Loads parameters from a config file for the inverse dynamics controller.

The format of the config file is defined in id_controller_config.proto.

For the ContactConfig and AccelerationConfig (defined in id_controller_config.proto), the name field should correspond to either a body group or joint group name in the associated RigidBodyTreeAliasGroups. Every member in that group will have the same parameters. A default parameter can also be specified for body_motion, dof_motion and contact for InverseDynamicsControllerConfig. It will be returned when parameters are not explicitly specified. It is recommended to supply the default parameters.

For AccelerationConfig, the number of recurrence for kp, kd and weight can either be 1 or exactly matches the dimension of the associated parameter. The first case is a simpler way for specifying everything with the same number. For example, when specifying parameters for spatial accelerations, kp, kd and weight need to be 6 dimensional. When used for accelerations in the generalized coordinates, kp, kd and weight need to match the dimension of that joint group. E.g. kp, kd and weight need to be 8 dimensional for a joint group that consists of a floating base joint and 2 single dof joints.

Parameters
config_pathPath to the config file.
alias_groupSpecifies the relationship between body / joint groups and the RigidBodyTree it is constructed from.
Exceptions
std::runtime_errorif the config file can not be parsed correctly.

Here is the call graph for this function:

Here is the caller graph for this function:

void LookupDesiredBodyMotionGains ( const std::string &  group_name,
const RigidBodyTreeAliasGroups< double > &  alias_group,
std::vector< Vector6< double >> *  kp,
std::vector< Vector6< double >> *  kd 
) const

Finds the kp and kd gains for all the bodies in the body group specified by group_name.

For each body in body group group_name, if it has no corresponding DesiredMotionParam, its kp and kd will be set to the values in the default DesiredMotionParam. The ith entry in kp and kd correspond to the ith entry in body group group_name. kp and kd will be resized to match the size of the body group specified by group_name. If group_name does not exist in alias_group, kp and kd will be cleared.

Parameters
group_nameName of the body group of interest.
alias_groupRigidBodyTreeAliasGroups specifying the relationship between body / joint groups and the RigidBodyTree it is constructed from.
[out]kpcontainer for kp's output.
[out]kdcontainer for kd's output.

Here is the call graph for this function:

Here is the caller graph for this function:

void LookupDesiredBodyMotionGains ( const RigidBody< double > &  body,
Vector6< double > *  kp,
Vector6< double > *  kd 
) const

Finds the kp and kd gains for body.

If it has no corresponding DesiredMotionParam, the kp and kd will be set to the values in the default DesiredMotionParam.

Parameters
bodyReferent to the RigidBody of interest.
[out]kpoutput.
[out]kdoutput.

Here is the call graph for this function:

void LookupDesiredCentroidalMomentumDotGains ( Vector6< double > *  kp,
Vector6< double > *  kd 
) const

Obtains the kp and kd gains for the centroidal momentum tracker.

Parameters
[out]kpoutput.
[out]kdoutput.
void LookupDesiredDofMotionGains ( VectorX< double > *  kp,
VectorX< double > *  kd 
) const

Obtains the kp and kd gains for all DoF.

kp and kd will be resized to match the number of DoFs of the RigidBodyTree in the RigidBodyTreeAliasGroups passed to LoadFromFile().

Parameters
[out]kpoutput.
[out]kdoutput.

Here is the caller graph for this function:

std::unordered_map< std::string, ContactInformation > MakeContactInformation ( const std::string &  group_name,
const RigidBodyTreeAliasGroups< double > &  alias_group 
) const

Returns a map from body names to ContactInformation, where the body names belong to the body group specified by group_name in alias_group.

For each body without a corresponding ContactParam, a ContactInformation will be constructed using the default ContactParam. If alias_group does not contain group_name, an empty map will be returned.

Parameters
group_nameName of the body group of interest.
alias_groupSpecifies the relationship between body / joint groups and the RigidBodyTree it is constructed from.
Returns
A map from body names to ContactInformation

Here is the call graph for this function:

Here is the caller graph for this function:

ContactInformation MakeContactInformation ( const RigidBody< double > &  body) const

Returns a single ContactInformation for body.

If body has no corresponding ContactParam, a ContactInformation constructed with the default ContactParam will be returned.

Here is the call graph for this function:

std::unordered_map< std::string, DesiredBodyMotion > MakeDesiredBodyMotion ( const std::string &  group_name,
const RigidBodyTreeAliasGroups< double > &  alias_group 
) const

Returns a map from body names to DesiredBodyMotions, where the body names belongs to the body group specified by group_name in alias_group.

This method only sets the weights and constraint_types fields of DesiredBodyMotion; it does not set the values, which must be set separately. For each body name, if it has no corresponding DesiredMotionParam, a DesiredBodyMotion will be constructed using the default DesiredMotionParam. If alias_group does not contain group_name, an empty map will be returned.

Parameters
group_nameName of the body group of interest.
alias_groupSpecifies the relationship between body / joint groups and the RigidBodyTree it is constructed from.
Returns
A map from body names to DesiredBodyMotions.

Here is the call graph for this function:

Here is the caller graph for this function:

DesiredBodyMotion MakeDesiredBodyMotion ( const RigidBody< double > &  body) const

Returns a single DesiredBodyMotion for body.

This method only sets the weights and constraint_types fields of DesiredBodyMotion; it does not set the values, which must be set separately. If body has no corresponding DesiredMotionParam, a DesiredBodyMotion constructed with the default DesiredMotionParam will be returned.

Here is the call graph for this function:

DesiredCentroidalMomentumDot MakeDesiredCentroidalMomentumDot ( ) const

Returns DesiredCentroidalMomentumDot configured by the DesiredMotionParam for centroidal momentum.

This method only sets the weights and constraint_types fields in DesiredCentroidalMomentumDot. The values field needs to be set separately.

Here is the call graph for this function:

Here is the caller graph for this function:

DesiredDofMotions MakeDesiredDofMotions ( ) const

Returns DesiredDofMotions configured by DesiredMotionParam for all DoF.

This method only sets the weights and constraint_types fields in DesiredDofMotions. The values field needs to be set separately. For each DoF with no DesiredMotionParam, the default DesiredMotionParam will be used.

Here is the call graph for this function:

Here is the caller graph for this function:

QpInput MakeQpInput ( const std::vector< std::string > &  contact_body_groups,
const std::vector< std::string > &  tracked_body_groups,
const RigidBodyTreeAliasGroups< double > &  alias_group 
) const

Returns a QpInput for the given contacts and tracked bodies using the parameters held by this instance.

Note that this function only sets the weights and constraint_types fields for DesiredBodyMotion and DesiredDofMotions, the desire accelerations need to be set separately by some control policy.

Parameters
contact_body_groupsNames of body groups that are in contact. For each body of each group, a ContactInformation will be populated in the returned QpInput.
tracked_body_groupsNames of body groups that are being tracked. For each body of each group, a DesiredBodyMotion will be populated in the returned QpInput.
alias_groupSpecifies the relationship between body / joint groups and the RigidBodyTree it is constructed from.

Here is the call graph for this function:

Here is the caller graph for this function:

QpInput MakeQpInput ( const std::vector< const RigidBody< double > * > &  contact_bodies,
const std::vector< const RigidBody< double > * > &  tracked_bodies,
const RigidBodyTreeAliasGroups< double > &  alias_group 
) const

Returns a QpInput for the given contacts and tracked bodies using the parameters held by this instance.

Note that this function only sets the weights and constraint_types fields for DesiredBodyMotion and DesiredDofMotions, the desire accelerations need to be set separately by some control policy.

Parameters
contact_bodiesPointers to bodies in contact.
tracked_bodiesPointers to bodies that have Cartesian tracking objectives.
alias_groupSpecifies the relationship between body / joint groups and the RigidBodyTree it is constructed from.

Here is the call graph for this function:

ParamSet& operator= ( const ParamSet )
delete
ParamSet& operator= ( ParamSet &&  )
delete
void set_name ( const std::string &  name)
inline

Sets the name of this ParamSet.

Parameters
nameNew name for this ParamSet.

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