Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
SymbolicVectorSystemBuilder Class Reference

Detailed Description

Builder design pattern to help with all of the optional arguments in the constructor of SymbolicVectorSystem.

For example, to define the system: ẋ = -x + x³, y = x, we could write

auto system = SymbolicVectorSystemBuilder().state(x)
.dynamics(-x + pow(x,3))
.output(x)
.Build();
Represents a symbolic variable.
Definition variable.h:34
SymbolicVectorSystemBuilder()
Definition symbolic_vector_system.h:236
x
Definition light_parameter.h:147
Polynomial< T > pow(const Polynomial< T > &base, typename Polynomial< T >::PowerType exponent)
Provides power function for Polynomial.
Definition polynomial.h:487
See also
SymbolicVectorSystem

#include <drake/systems/primitives/symbolic_vector_system.h>

Public Member Functions

 SymbolicVectorSystemBuilder ()
SymbolicVectorSystemBuilder time (const symbolic::Variable &t)
 Sets the time variable.
SymbolicVectorSystemBuilder state (const symbolic::Variable &v)
 Sets the state variable (scalar version).
SymbolicVectorSystemBuilder state (const Eigen::Ref< const VectorX< symbolic::Variable > > &vars)
 Sets the state variables (Eigen::Vector version).
SymbolicVectorSystemBuilder state (const std::vector< symbolic::Variable > &vars)
 Sets the state variables (std::vector version).
SymbolicVectorSystemBuilder input (const symbolic::Variable &v)
 Sets the input variable (scalar version).
SymbolicVectorSystemBuilder input (const Eigen::Ref< const VectorX< symbolic::Variable > > &vars)
 Sets the input variables (Eigen::Vector version).
SymbolicVectorSystemBuilder input (const std::vector< symbolic::Variable > &vars)
 Sets the input variables (std::vector version).
SymbolicVectorSystemBuilder parameter (const symbolic::Variable &v)
 Sets the parameter variable (scalar version).
SymbolicVectorSystemBuilder parameter (const Eigen::Ref< const VectorX< symbolic::Variable > > &vars)
 Sets the parameter variables (Eigen::Vector version).
SymbolicVectorSystemBuilder parameter (const std::vector< symbolic::Variable > &vars)
 Sets the parameter variables (std::vector version).
SymbolicVectorSystemBuilder dynamics (const symbolic::Expression &e)
 Sets the dynamics method (scalar version).
SymbolicVectorSystemBuilder dynamics (const Eigen::Ref< const VectorX< symbolic::Expression > > &e)
 Sets the dynamics method (Eigen::Vector version).
SymbolicVectorSystemBuilder dynamics (const std::vector< symbolic::Expression > &e)
 Sets the dynamics variables (std::vector version).
SymbolicVectorSystemBuilder output (const symbolic::Expression &e)
 Sets the output method (scalar version).
SymbolicVectorSystemBuilder output (const Eigen::Ref< const VectorX< symbolic::Expression > > &e)
 Sets the output method (Eigen::Vector version).
SymbolicVectorSystemBuilder output (const std::vector< symbolic::Expression > &e)
 Sets the output variables (std::vector version).
SymbolicVectorSystemBuilder LinearizeDynamics (const Eigen::Ref< const VectorX< symbolic::Expression > > &x0, const Eigen::Ref< const VectorX< symbolic::Expression > > &u0)
 Linearizes the system dynamics around (x0, u0) using the first-order Taylor Series expansion.
SymbolicVectorSystemBuilder time_period (double p)
 Sets the time period (0 is continuous time).
template<typename T = double>
std::unique_ptr< SymbolicVectorSystem< T > > Build ()
 Dispatches to the SymbolicVectorSystem constructor with our accumulated arguments.
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 SymbolicVectorSystemBuilder (const SymbolicVectorSystemBuilder &)=default
SymbolicVectorSystemBuilderoperator= (const SymbolicVectorSystemBuilder &)=default
 SymbolicVectorSystemBuilder (SymbolicVectorSystemBuilder &&)=default
SymbolicVectorSystemBuilderoperator= (SymbolicVectorSystemBuilder &&)=default
Accessor methods.

Returns the time variable if exists.

const std::optional< symbolic::Variable > & time () const
const VectorX< symbolic::Variable > & state () const
 Returns the state variables.
const VectorX< symbolic::Variable > & input () const
 Returns the input variables.
const VectorX< symbolic::Variable > & parameter () const
 Returns the parameter variables.
const VectorX< symbolic::Expression > & dynamics () const
 Returns the dynamics.

Constructor & Destructor Documentation

◆ SymbolicVectorSystemBuilder() [1/3]

◆ SymbolicVectorSystemBuilder() [2/3]

◆ SymbolicVectorSystemBuilder() [3/3]

Member Function Documentation

◆ Build()

template<typename T = double>
std::unique_ptr< SymbolicVectorSystem< T > > Build ( )

Dispatches to the SymbolicVectorSystem constructor with our accumulated arguments.

◆ dynamics() [1/4]

const VectorX< symbolic::Expression > & dynamics ( ) const

Returns the dynamics.

◆ dynamics() [2/4]

SymbolicVectorSystemBuilder dynamics ( const Eigen::Ref< const VectorX< symbolic::Expression > > & e)

Sets the dynamics method (Eigen::Vector version).

◆ dynamics() [3/4]

SymbolicVectorSystemBuilder dynamics ( const std::vector< symbolic::Expression > & e)

Sets the dynamics variables (std::vector version).

◆ dynamics() [4/4]

Sets the dynamics method (scalar version).

◆ input() [1/4]

const VectorX< symbolic::Variable > & input ( ) const

Returns the input variables.

◆ input() [2/4]

SymbolicVectorSystemBuilder input ( const Eigen::Ref< const VectorX< symbolic::Variable > > & vars)

Sets the input variables (Eigen::Vector version).

◆ input() [3/4]

SymbolicVectorSystemBuilder input ( const std::vector< symbolic::Variable > & vars)

Sets the input variables (std::vector version).

◆ input() [4/4]

Sets the input variable (scalar version).

◆ LinearizeDynamics()

SymbolicVectorSystemBuilder LinearizeDynamics ( const Eigen::Ref< const VectorX< symbolic::Expression > > & x0,
const Eigen::Ref< const VectorX< symbolic::Expression > > & u0 )

Linearizes the system dynamics around (x0, u0) using the first-order Taylor Series expansion.

Precondition
The length of x0 should be the length of state().
The length of u0 should be the length of input().
x0 and u0 should not include a state variable or an input variable.
Note
If x0 or u0 includes a variable new to this system builder, it will be added to this system builder as a parameter.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ output() [1/3]

SymbolicVectorSystemBuilder output ( const Eigen::Ref< const VectorX< symbolic::Expression > > & e)

Sets the output method (Eigen::Vector version).

◆ output() [2/3]

SymbolicVectorSystemBuilder output ( const std::vector< symbolic::Expression > & e)

Sets the output variables (std::vector version).

◆ output() [3/3]

Sets the output method (scalar version).

◆ parameter() [1/4]

const VectorX< symbolic::Variable > & parameter ( ) const

Returns the parameter variables.

◆ parameter() [2/4]

SymbolicVectorSystemBuilder parameter ( const Eigen::Ref< const VectorX< symbolic::Variable > > & vars)

Sets the parameter variables (Eigen::Vector version).

◆ parameter() [3/4]

SymbolicVectorSystemBuilder parameter ( const std::vector< symbolic::Variable > & vars)

Sets the parameter variables (std::vector version).

◆ parameter() [4/4]

Sets the parameter variable (scalar version).

◆ state() [1/4]

const VectorX< symbolic::Variable > & state ( ) const

Returns the state variables.

◆ state() [2/4]

SymbolicVectorSystemBuilder state ( const Eigen::Ref< const VectorX< symbolic::Variable > > & vars)

Sets the state variables (Eigen::Vector version).

◆ state() [3/4]

SymbolicVectorSystemBuilder state ( const std::vector< symbolic::Variable > & vars)

Sets the state variables (std::vector version).

◆ state() [4/4]

Sets the state variable (scalar version).

◆ time() [1/2]

const std::optional< symbolic::Variable > & time ( ) const

◆ time() [2/2]

Sets the time variable.

◆ time_period()

Sets the time period (0 is continuous time).


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