Drake
SystemSymbolicInspector Class Reference

The SystemSymbolicInspector uses symbolic::Expressions to analyze various properties of the System, such as time invariance and input-to-output sparsity, along with many others. More...

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

## Public Member Functions

SystemSymbolicInspector (const System< symbolic::Expression > &system)
Constructs a SystemSymbolicInspector for the given system by initializing every vector-valued element in the Context with symbolic variables. More...

~SystemSymbolicInspector ()=default

bool IsConnectedInputToOutput (int input_port_index, int output_port_index) const
Returns true if the input port at the given input_port_index is or might possibly be a term in the output at the given output_port_index. More...

bool IsTimeInvariant () const
Returns true if there is no dependence on time in the dynamics (continuous nor discrete) nor the outputs. More...

bool HasAffineDynamics () const
Returns true iff all of the derivatives and discrete updates have at most an affine dependence on state and input. More...

Does not allow copy, move, or assignment
SystemSymbolicInspector (const SystemSymbolicInspector &)=delete

SystemSymbolicInspectoroperator= (const SystemSymbolicInspector &)=delete

SystemSymbolicInspector (SystemSymbolicInspector &&)=delete

SystemSymbolicInspectoroperator= (SystemSymbolicInspector &&)=delete

Reference symbolic components

A set of accessor methods that provide direct access to the symbolic forms of the System.

This class carefully sets up and names all of the symbolic elements of the Context, and other methods should be able to reap the benefits.

Returns a reference to the symbolic representation of time.

const symbolic::Variabletime () const

Eigen::VectorBlock< const VectorX< symbolic::Variable > > input (int i) const
Returns a reference to the symbolic representation of the input. More...

Eigen::VectorBlock< const VectorX< symbolic::Variable > > continuous_state () const
Returns a reference to the symbolic representation of the continuous state. More...

Eigen::VectorBlock< const VectorX< symbolic::Variable > > discrete_state (int i) const
Returns a reference to the symbolic representation of the discrete state. More...

Eigen::VectorBlock< const VectorX< symbolic::Variable > > numeric_parameters (int i) const
Returns a reference to the symbolic representation of the numeric parameters. More...

VectorX< symbolic::Expressionderivatives () const
Returns a copy of the symbolic representation of the continuous-time dynamics. More...

Eigen::VectorBlock< const VectorX< symbolic::Expression > > discrete_update (int i) const
Returns a reference to the symbolic representation of the discrete-time dynamics. More...

Eigen::VectorBlock< const VectorX< symbolic::Expression > > output (int i) const
Returns a reference to the symbolic representation of the output. More...

const std::set< symbolic::Formula > & constraints () const
Returns a reference to the symbolic representation of the constraints. More...

## Detailed Description

The SystemSymbolicInspector uses symbolic::Expressions to analyze various properties of the System, such as time invariance and input-to-output sparsity, along with many others.

A SystemSymbolicInspector is only interesting if the Context contains purely vector-valued elements. If any abstract-valued elements are present, the SystemSymbolicInspector will not be able to parse the governing equations reliably.

It would be possible to report system properties for a specific configuration of the abstract inputs, state, or parameters. We intentionally do not provide such an analysis, because it would invite developers to shoot themselves in the foot by accidentally overstating sparsity, for instance if a given input affects a given output in some modes, but not the mode tested.

Even with that limitation on scope, SystemSymbolicInspector has risks, if the System contains C++ native conditionals like "if" or "switch". symbolic::Expression does not provide an implicit conversion to bool, so it is unlikely that anyone will accidentally write a System that both uses native conditionals and compiles with a symbolic::Expression scalar type. However, it is possible, for instance using an explicit cast, or std::equal_to.

## ◆ SystemSymbolicInspector() [1/3]

 SystemSymbolicInspector ( const System< symbolic::Expression > & system )
explicit

Constructs a SystemSymbolicInspector for the given system by initializing every vector-valued element in the Context with symbolic variables.

## ◆ ~SystemSymbolicInspector()

 ~SystemSymbolicInspector ( )
default

## ◆ SystemSymbolicInspector() [2/3]

 SystemSymbolicInspector ( const SystemSymbolicInspector & )
delete

## ◆ SystemSymbolicInspector() [3/3]

 SystemSymbolicInspector ( SystemSymbolicInspector && )
delete

## ◆ constraints()

 const std::set& constraints ( ) const

Returns a reference to the symbolic representation of the constraints.

## ◆ continuous_state()

 Eigen::VectorBlock > continuous_state ( ) const

Returns a reference to the symbolic representation of the continuous state.

## ◆ derivatives()

 VectorX derivatives ( ) const

Returns a copy of the symbolic representation of the continuous-time dynamics.

## ◆ discrete_state()

 Eigen::VectorBlock > discrete_state ( int i ) const

Returns a reference to the symbolic representation of the discrete state.

Parameters
 i The discrete state group number.

## ◆ discrete_update()

 Eigen::VectorBlock > discrete_update ( int i ) const

Returns a reference to the symbolic representation of the discrete-time dynamics.

Parameters
 i The discrete state group number.

## ◆ HasAffineDynamics()

 bool HasAffineDynamics ( ) const

Returns true iff all of the derivatives and discrete updates have at most an affine dependence on state and input.

Note that the return value does NOT depend on the output methods (they may be affine or not).

## ◆ input()

 Eigen::VectorBlock > input ( int i ) const

Returns a reference to the symbolic representation of the input.

Parameters
 i The input port number.

## ◆ IsConnectedInputToOutput()

 bool IsConnectedInputToOutput ( int input_port_index, int output_port_index ) const

Returns true if the input port at the given input_port_index is or might possibly be a term in the output at the given output_port_index.

## ◆ IsTimeInvariant()

 bool IsTimeInvariant ( ) const

Returns true if there is no dependence on time in the dynamics (continuous nor discrete) nor the outputs.

## ◆ numeric_parameters()

 Eigen::VectorBlock > numeric_parameters ( int i ) const

Returns a reference to the symbolic representation of the numeric parameters.

Parameters
 i The numeric parameter group number.

## ◆ operator=() [1/2]

 SystemSymbolicInspector& operator= ( SystemSymbolicInspector && )
delete

## ◆ operator=() [2/2]

 SystemSymbolicInspector& operator= ( const SystemSymbolicInspector & )
delete

## ◆ output()

 Eigen::VectorBlock > output ( int i ) const

Returns a reference to the symbolic representation of the output.

Parameters
 i The output port number.

## ◆ time()

 const symbolic::Variable& time ( ) const

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