Drake
Drake C++ Documentation
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename U >
const U & get_abstract_state (int index) const
 Returns a const pointer to the abstract component of the state at index. More...
 
template<typename U >
U & get_mutable_abstract_state (int index)
 Returns a mutable pointer to element index of the abstract state. More...
 
template<typename U >
void SetFrom (const State< U > &other)
 Initializes this state from a State. More...
 
Does not allow copy, move, or assignment
 State (const State &)=delete
 
Stateoperator= (const State &)=delete
 
 State (State &&)=delete
 
Stateoperator= (State &&)=delete
 
System compatibility
internal::SystemId get_system_id () const
 (Internal use only) Gets the id of the subsystem that created this state. More...
 
void set_system_id (internal::SystemId id)
 (Internal use only) Records the id of the subsystem that created this state. More...
 

Constructor & Destructor Documentation

◆ State() [1/3]

State ( const State< T > &  )
delete

◆ State() [2/3]

State ( State< T > &&  )
delete

◆ State() [3/3]

State ( )

◆ ~State()

virtual ~State ( )
virtual

Member Function Documentation

◆ get_abstract_state() [1/2]

const AbstractValues& get_abstract_state ( ) const

◆ get_abstract_state() [2/2]

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()

const ContinuousState<T>& get_continuous_state ( ) const

◆ get_discrete_state() [1/2]

const DiscreteValues<T>& get_discrete_state ( ) const

◆ get_discrete_state() [2/2]

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

◆ get_mutable_abstract_state() [1/2]

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]

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()

ContinuousState<T>& get_mutable_continuous_state ( )

◆ get_mutable_discrete_state() [1/2]

DiscreteValues<T>& get_mutable_discrete_state ( )

◆ get_mutable_discrete_state() [2/2]

BasicVector<T>& get_mutable_discrete_state ( int  index)

◆ get_system_id()

internal::SystemId get_system_id ( ) const

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ set_abstract_state()

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()

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()

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()

void set_system_id ( internal::SystemId  id)

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

◆ SetFrom()

void SetFrom ( const State< U > &  other)

Initializes this state from a State.


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