Drake
ConstrainedValues Class Reference

Base class for specifying various desired objectives. More...

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

Public Member Functions

 ConstrainedValues ()
 Constructs a ConstrainedValues object with 0 dimension. More...
 
 ConstrainedValues (int dim)
 Constructs a ConstrainedValues object with dimension dim. More...
 
void resize (int dim)
 
void SetAllConstraintTypesBasedOnWeights ()
 Sets all the ConstraintType enums based on their corresponding weight values. More...
 
std::list< intGetConstraintTypeIndices (ConstraintType type) const
 Gets all the indices that have the specified constraint type. More...
 
void SetConstraintType (const std::list< int > &indices, ConstraintType type)
 Sets the given indices' constraint types to the given type. More...
 
void SetAllConstraintType (ConstraintType type)
 Sets all constraint types to the given type. More...
 
bool is_valid () const
 
bool is_valid (int dim) const
 
bool operator== (const ConstrainedValues &other) const
 
bool operator!= (const ConstrainedValues &other) const
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 ConstrainedValues (const ConstrainedValues &)=default
 
ConstrainedValuesoperator= (const ConstrainedValues &)=default
 
 ConstrainedValues (ConstrainedValues &&)=default
 
ConstrainedValuesoperator= (ConstrainedValues &&)=default
 
Accessors
int size () const
 
const VectorX< double > & weights () const
 
const VectorX< double > & values () const
 
const std::vector< ConstraintType > & constraint_types () const
 
double value (int i) const
 
double weight (int i) const
 
ConstraintType constraint_type (int i) const
 
VectorX< double > & mutable_weights ()
 
VectorX< double > & mutable_values ()
 
std::vector< ConstraintType > & mutable_constraint_types ()
 
doublemutable_value (int i)
 
doublemutable_weight (int i)
 
ConstraintTypemutable_constraint_type (int i)
 

Detailed Description

Base class for specifying various desired objectives.

The objectives can be ignored, set as equality constraints or optimized as cost terms depending on the specified types. For cost terms, a positive weight needs to be specified.

Constructor & Destructor Documentation

◆ ConstrainedValues() [1/4]

ConstrainedValues ( const ConstrainedValues )
default

◆ ConstrainedValues() [2/4]

◆ ConstrainedValues() [3/4]

ConstrainedValues ( )
inline

Constructs a ConstrainedValues object with 0 dimension.

◆ ConstrainedValues() [4/4]

ConstrainedValues ( int  dim)
inlineexplicit

Constructs a ConstrainedValues object with dimension dim.

All weights and values are initialized to zero, and constraint types are set to ConstraintType::Skip.

Member Function Documentation

◆ constraint_type()

ConstraintType constraint_type ( int  i) const
inline

◆ constraint_types()

const std::vector<ConstraintType>& constraint_types ( ) const
inline

◆ GetConstraintTypeIndices()

std::list< int > GetConstraintTypeIndices ( ConstraintType  type) const

Gets all the indices that have the specified constraint type.

Parameters
typeMatching constraint type
Returns
indices

◆ is_valid() [1/2]

bool is_valid ( ) const
inline

◆ is_valid() [2/2]

bool is_valid ( int  dim) const

◆ mutable_constraint_type()

ConstraintType& mutable_constraint_type ( int  i)
inline

◆ mutable_constraint_types()

std::vector<ConstraintType>& mutable_constraint_types ( )
inline

◆ mutable_value()

double& mutable_value ( int  i)
inline

◆ mutable_values()

VectorX<double>& mutable_values ( )
inline

◆ mutable_weight()

double& mutable_weight ( int  i)
inline

◆ mutable_weights()

VectorX<double>& mutable_weights ( )
inline

◆ operator!=()

bool operator!= ( const ConstrainedValues other) const
inline

◆ operator=() [1/2]

ConstrainedValues& operator= ( ConstrainedValues &&  )
default

◆ operator=() [2/2]

ConstrainedValues& operator= ( const ConstrainedValues )
default

◆ operator==()

bool operator== ( const ConstrainedValues other) const

◆ resize()

void resize ( int  dim)

◆ SetAllConstraintType()

void SetAllConstraintType ( ConstraintType  type)

Sets all constraint types to the given type.

Parameters
typeDesired type

◆ SetAllConstraintTypesBasedOnWeights()

void SetAllConstraintTypesBasedOnWeights ( )

Sets all the ConstraintType enums based on their corresponding weight values.

ConstraintType is set to:

  ConstraintType::Soft if weight > 0
  ConstraintType::Skip if weight = 0
  ConstraintType::Hard if weight < 0

◆ SetConstraintType()

void SetConstraintType ( const std::list< int > &  indices,
ConstraintType  type 
)

Sets the given indices' constraint types to the given type.

Parameters
indicesList of indices
typeDesired type

◆ size()

int size ( ) const
inline

◆ value()

double value ( int  i) const
inline

◆ values()

const VectorX<double>& values ( ) const
inline

◆ weight()

double weight ( int  i) const
inline

◆ weights()

const VectorX<double>& weights ( ) const
inline

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