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:
xc
xd
xa
T | The 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 AbstractValues & | get_abstract_state () const |
AbstractValues & | get_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 | |
State & | operator= (const State &)=delete |
State (State &&)=delete | |
State & | operator= (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. More... | |
void | set_system_id (internal::SystemId id) |
(Internal use only) Records the id of the subsystem that created this state. More... | |
State | ( | ) |
|
virtual |
const AbstractValues& get_abstract_state | ( | ) | const |
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.
const ContinuousState<T>& get_continuous_state | ( | ) | const |
const DiscreteValues<T>& get_discrete_state | ( | ) | const |
const BasicVector<T>& get_discrete_state | ( | int | index | ) | const |
AbstractValues& get_mutable_abstract_state | ( | ) |
Returns a mutable reference to the abstract component of the state, which may be of size zero.
U& get_mutable_abstract_state | ( | int | index | ) |
Returns a mutable pointer to element index
of the abstract state.
Asserts if index
doesn't exist.
ContinuousState<T>& get_mutable_continuous_state | ( | ) |
DiscreteValues<T>& get_mutable_discrete_state | ( | ) |
BasicVector<T>& get_mutable_discrete_state | ( | int | index | ) |
internal::SystemId get_system_id | ( | ) | const |
(Internal use only) Gets the id of the subsystem that created this state.
void set_abstract_state | ( | std::unique_ptr< AbstractValues > | xa | ) |
(Advanced) Defines the abstract state variables for this State.
void set_continuous_state | ( | std::unique_ptr< ContinuousState< T >> | xc | ) |
(Advanced) Defines the continuous state variables for this State.
void set_discrete_state | ( | std::unique_ptr< DiscreteValues< T >> | xd | ) |
(Advanced) Defines the discrete state variables for this State.
void set_system_id | ( | internal::SystemId | id | ) |
(Internal use only) Records the id of the subsystem that created this state.