Drake
SystemConstraint< T > Class Template Reference

A SystemConstraint is a generic base-class for constraints on Systems. More...

#include <drake/systems/framework/system_constraint.h>

Public Types

using CalcCallback = std::function< void(const Context< T > &context, VectorX< T > *value)>
 This is the signature of a stateless function that evaluates the value of the constraint function f: value = f(context), where value has the dimension specified in the constructor. More...
 

Public Member Functions

 SystemConstraint (CalcCallback calc_function, int count, bool is_equality_constraint, const std::string &description)
 Constructs the SystemConstraint. More...
 
virtual ~SystemConstraint ()=default
 
void Calc (const Context< T > &context, VectorX< T > *value) const
 Evaluates the function pointer passed in through the constructor, writing the output to value. More...
 
template<typename T1 = T>
std::enable_if< is_numeric< T1 >::value, bool >::type CheckSatisfied (const Context< T1 > &context, double tol=1E-6) const
 Evaluates the function pointer, and check if all of the outputs are within the desired bounds. More...
 
int size () const
 
bool is_equality_constraint () const
 
const std::string & description () const
 
Does not allow copy, move, or assignment
 SystemConstraint (const SystemConstraint &)=delete
 
SystemConstraintoperator= (const SystemConstraint &)=delete
 
 SystemConstraint (SystemConstraint &&)=delete
 
SystemConstraintoperator= (SystemConstraint &&)=delete
 

Detailed Description

template<typename T>
class drake::systems::SystemConstraint< T >

A SystemConstraint is a generic base-class for constraints on Systems.

A SystemConstraint is a means to inform our algorithms about the implemented system behavior – declaring the constraint does not cause the system behavior to change. It is meant to improve analysis by telling our algorithms that "all valid solutions of this dynamical system will satisfy the following (in)equalities". Examples could include conserved quantities or joint limits on a mechanism.

This class is intentionally compatible with, but (so far) independent from solvers::Constraint. This is primarily because there is no notion of decision variables in the system classes (yet); rather each individual algorithm (e.g. trajectory optimization, or system identification) constructs decision variables for the particular mathematical program that is being formulated, and must bind the system constraint to those variables (e.g. by populating the Context with the decision variables and calling Calc).

See also
LeafSystem<T>::DeclareConstraint for use cases.
Template Parameters
TThe vector element type, which must be a valid Eigen scalar.

Instantiated templates for the following kinds of T's are provided:

They are already available to link against in the containing library.

Member Typedef Documentation

using CalcCallback = std::function<void(const Context<T>& context, VectorX<T>* value)>

This is the signature of a stateless function that evaluates the value of the constraint function f: value = f(context), where value has the dimension specified in the constructor.

Constructor & Destructor Documentation

SystemConstraint ( const SystemConstraint< T > &  )
delete
SystemConstraint ( SystemConstraint< T > &&  )
delete
SystemConstraint ( CalcCallback  calc_function,
int  count,
bool  is_equality_constraint,
const std::string &  description 
)
inline

Constructs the SystemConstraint.

Parameters
countthe number of constraints (size of the value vector).
is_equality_constrainttrue implies that the constraint is of the form f(x)=0, false implies an inequality constraint of the form f(x)≥0.
descriptiona human-readable description useful for debugging.
virtual ~SystemConstraint ( )
virtualdefault

Here is the caller graph for this function:

Member Function Documentation

void Calc ( const Context< T > &  context,
VectorX< T > *  value 
) const
inline

Evaluates the function pointer passed in through the constructor, writing the output to value.

value will be (non-conservatively) resized to match the constraint function output.

Here is the caller graph for this function:

std::enable_if<is_numeric<T1>::value, bool>::type CheckSatisfied ( const Context< T1 > &  context,
double  tol = 1E-6 
) const
inline

Evaluates the function pointer, and check if all of the outputs are within the desired bounds.

const std::string& description ( ) const
inline
bool is_equality_constraint ( ) const
inline

Here is the caller graph for this function:

SystemConstraint& operator= ( SystemConstraint< T > &&  )
delete
SystemConstraint& operator= ( const SystemConstraint< T > &  )
delete
int size ( ) const
inline

Here is the caller graph for this function:


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