Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
State< T > Class Template Reference

Detailed Description

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

State is a container for all the data comprising the complete state of a particular System at a particular moment.

Any field in State may be empty if it is not applicable to the System in question. A System may not maintain state in any place other than a State object.

A State x contains three types of state variables:

  • Continuous state xc
  • Discrete state xd
  • Abstract state xa
Template Parameters
TThe scalar type, which must be one of the default scalars.

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

Public Member Functions

 State ()
virtual ~State ()
void set_continuous_state (std::unique_ptr< ContinuousState< T > > xc)
 (Advanced) Defines the continuous state variables for this State.
const ContinuousState< T > & get_continuous_state () const
ContinuousState< T > & get_mutable_continuous_state ()
void set_discrete_state (std::unique_ptr< DiscreteValues< T > > xd)
 (Advanced) Defines the discrete state variables for this State.
const DiscreteValues< T > & get_discrete_state () const
DiscreteValues< T > & get_mutable_discrete_state ()
const BasicVector< T > & get_discrete_state (int index) const
BasicVector< T > & get_mutable_discrete_state (int index)
void set_abstract_state (std::unique_ptr< AbstractValues > xa)
 (Advanced) Defines the abstract state variables for this State.
const AbstractValuesget_abstract_state () const
AbstractValuesget_mutable_abstract_state ()
 Returns a mutable reference to the abstract component of the state, which may be of size zero.
template<typename U>
const U & get_abstract_state (int index) const
 Returns a const pointer to the abstract component of the state at index.
template<typename U>
U & get_mutable_abstract_state (int index)
 Returns a mutable pointer to element index of the abstract state.
template<typename U>
void SetFrom (const State< U > &other)
 Initializes this state from a State.
Does not allow copy, move, or assignment
 State (const State &)=delete
Stateoperator= (const State &)=delete
 State (State &&)=delete
Stateoperator= (State &&)=delete

System compatibility

See System Compatibility.

internal::SystemId get_system_id () const
 (Internal use only) Gets the id of the subsystem that created this state.
void set_system_id (internal::SystemId id)
 (Internal use only) Records the id of the subsystem that created this state.

Constructor & Destructor Documentation

◆ State() [1/3]

template<typename T>
State ( const State< T > & )
delete

◆ State() [2/3]

template<typename T>
State ( State< T > && )
delete

◆ State() [3/3]

template<typename T>
State ( )

◆ ~State()

template<typename T>
virtual ~State ( )
virtual

Member Function Documentation

◆ get_abstract_state() [1/2]

template<typename T>
const AbstractValues & get_abstract_state ( ) const

◆ get_abstract_state() [2/2]

template<typename T>
template<typename U>
const U & get_abstract_state ( int index) const

Returns a const pointer to the abstract component of the state at index.

Asserts if index doesn't exist.

◆ get_continuous_state()

template<typename T>
const ContinuousState< T > & get_continuous_state ( ) const

◆ get_discrete_state() [1/2]

template<typename T>
const DiscreteValues< T > & get_discrete_state ( ) const

◆ get_discrete_state() [2/2]

template<typename T>
const BasicVector< T > & get_discrete_state ( int index) const

◆ get_mutable_abstract_state() [1/2]

template<typename T>
AbstractValues & get_mutable_abstract_state ( )

Returns a mutable reference to the abstract component of the state, which may be of size zero.

◆ get_mutable_abstract_state() [2/2]

template<typename T>
template<typename U>
U & get_mutable_abstract_state ( int index)

Returns a mutable pointer to element index of the abstract state.

Asserts if index doesn't exist.

◆ get_mutable_continuous_state()

template<typename T>
ContinuousState< T > & get_mutable_continuous_state ( )

◆ get_mutable_discrete_state() [1/2]

template<typename T>
DiscreteValues< T > & get_mutable_discrete_state ( )

◆ get_mutable_discrete_state() [2/2]

template<typename T>
BasicVector< T > & get_mutable_discrete_state ( int index)

◆ get_system_id()

template<typename T>
internal::SystemId get_system_id ( ) const

(Internal use only) Gets the id of the subsystem that created this state.

◆ operator=() [1/2]

template<typename T>
State & operator= ( const State< T > & )
delete

◆ operator=() [2/2]

template<typename T>
State & operator= ( State< T > && )
delete

◆ set_abstract_state()

template<typename T>
void set_abstract_state ( std::unique_ptr< AbstractValues > xa)

(Advanced) Defines the abstract state variables for this State.

Warning
Do not use this function to resize or change types of abstract state variables in a State that is owned by an existing Context.

◆ set_continuous_state()

template<typename T>
void set_continuous_state ( std::unique_ptr< ContinuousState< T > > xc)

(Advanced) Defines the continuous state variables for this State.

Warning
Do not use this function to resize continuous state in a State that is owned by an existing Context.

◆ set_discrete_state()

template<typename T>
void set_discrete_state ( std::unique_ptr< DiscreteValues< T > > xd)

(Advanced) Defines the discrete state variables for this State.

Warning
Do not use this function to resize discrete state in a State that is owned by an existing Context.

◆ set_system_id()

template<typename T>
void set_system_id ( internal::SystemId id)

(Internal use only) Records the id of the subsystem that created this state.

◆ SetFrom()

template<typename T>
template<typename U>
void SetFrom ( const State< U > & other)

Initializes this state from a State.


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