Drake
SystemConstraint< T > Class Template Referencefinal

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

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

Public Types

using CalcCallback = ContextConstraintCalc< T >
 

Public Member Functions

 SystemConstraint (const System< T > *system, std::string description)
 (Advanced) Constructs a default (zero-sized) SystemConstraint. More...
 
 SystemConstraint (const System< T > *system, ContextConstraintCalc< T > calc_function, SystemConstraintBounds bounds, std::string description)
 (Advanced) Constructs a SystemConstraint. More...
 
 SystemConstraint (const System< T > *system, SystemConstraintCalc< T > calc_function, SystemConstraintBounds bounds, std::string description)
 (Advanced) Constructs a 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...
 
boolean< T > CheckSatisfied (const Context< T > &context, double tol) const
 Evaluates the function pointer, and check if all of the outputs are within the desired bounds. More...
 
const System< T > & get_system () const
 Returns a reference to the System that owns this constraint. More...
 
const SystemConstraintBoundsbounds () const
 
int size () const
 
SystemConstraintType type () const
 
bool is_equality_constraint () const
 
const Eigen::VectorXd & lower_bound () const
 
const Eigen::VectorXd & upper_bound () 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).

We can convert a SystemConstraint to a solvers::Constraint by using SystemConstraintWrapper or SystemConstraintAdapter.

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

◆ CalcCallback

Constructor & Destructor Documentation

◆ SystemConstraint() [1/5]

SystemConstraint ( const SystemConstraint< T > &  )
delete

◆ SystemConstraint() [2/5]

SystemConstraint ( SystemConstraint< T > &&  )
delete

◆ SystemConstraint() [3/5]

SystemConstraint ( const System< T > *  system,
std::string  description 
)

(Advanced) Constructs a default (zero-sized) SystemConstraint.

Most users should call a LeafSystem method like DeclareEqualityConstraint to create (and add) constraints, not call this constructor directly.

Parameters
descriptiona human-readable description useful for debugging.

◆ SystemConstraint() [4/5]

SystemConstraint ( const System< T > *  system,
ContextConstraintCalc< T >  calc_function,
SystemConstraintBounds  bounds,
std::string  description 
)

(Advanced) Constructs a SystemConstraint.

Depending on the bounds it could be an equality constraint f(x) = 0, or an inequality constraint lower_bound <= f(x) <= upper_bound.

Most users should call a LeafSystem method like DeclareEqualityConstraint to create (and add) constraints, not call this constructor directly.

Parameters
descriptiona human-readable description useful for debugging.

◆ SystemConstraint() [5/5]

SystemConstraint ( const System< T > *  system,
SystemConstraintCalc< T >  calc_function,
SystemConstraintBounds  bounds,
std::string  description 
)

(Advanced) Constructs a SystemConstraint.

Depending on the bounds it could be an equality constraint f(x) = 0, or an inequality constraint lower_bound <= f(x) <= upper_bound.

Most users should call a LeafSystem method like DeclareEqualityConstraint to create (and add) constraints, not call this constructor directly.

Parameters
descriptiona human-readable description useful for debugging.

Member Function Documentation

◆ bounds()

const SystemConstraintBounds& bounds ( ) const

◆ Calc()

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

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.

◆ CheckSatisfied()

boolean<T> CheckSatisfied ( const Context< T > &  context,
double  tol 
) const

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

◆ description()

const std::string& description ( ) const

◆ get_system()

const System<T>& get_system ( ) const

Returns a reference to the System that owns this constraint.

Note that for a constraint on a diagram this will be the diagram itself, never a leaf system whose constraint was re-expressed.

◆ is_equality_constraint()

bool is_equality_constraint ( ) const

◆ lower_bound()

const Eigen::VectorXd& lower_bound ( ) const

◆ operator=() [1/2]

SystemConstraint& operator= ( SystemConstraint< T > &&  )
delete

◆ operator=() [2/2]

SystemConstraint& operator= ( const SystemConstraint< T > &  )
delete

◆ size()

int size ( ) const

◆ type()

SystemConstraintType type ( ) const

◆ upper_bound()

const Eigen::VectorXd& upper_bound ( ) const

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