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, SystemConstraintType type, const std::string &description)
 Constructs the SystemConstraint. More...
 
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) const
 Evaluates the function pointer, and check if all of the outputs are within the desired bounds. More...
 
template<typename T1 = T>
std::enable_if<!is_numeric< T1 >::value, bool >::type CheckSatisfied (const Context< T1 > &context, double tol) const
 Supports CheckSatisfied calls for non-numeric scalar types by simply returning true. More...
 
int size () const
 
SystemConstraintType type () 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 similar to, 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>::DeclareEqualityConstraint and LeafSystem<T>::DeclareInequalityConstraint 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,
SystemConstraintType  type,
const std::string &  description 
)
inline

Constructs the SystemConstraint.

Parameters
countthe number of constraints (size of the value vector).
typethe SystemConstraintType.
descriptiona human-readable description useful for debugging.

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 
) const
inline

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

std::enable_if<!is_numeric<T1>::value, bool>::type CheckSatisfied ( const Context< T1 > &  context,
double  tol 
) const
inline

Supports CheckSatisfied calls for non-numeric scalar types by simply returning true.

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:

SystemConstraintType type ( ) const
inline

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