Drake
DiagramContinuousState< T > Class Template Referencefinal

DiagramContinuousState is a ContinuousState consisting of Supervectors xc, q, v, z over the corresponding entries in a set of referenced ContinuousState objects, which may or may not be owned by this DiagramContinuousState. More...

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

Inheritance diagram for DiagramContinuousState< T >:
[legend]
Collaboration diagram for DiagramContinuousState< T >:
[legend]

## Public Member Functions

DiagramContinuousState (std::vector< ContinuousState< T > * > substates)
Constructs a ContinuousState that is composed of other ContinuousStates, which are not owned by this object and must outlive it. More...

DiagramContinuousState (std::vector< std::unique_ptr< ContinuousState< T >>> substates)
Constructs a ContinuousState that is composed (recursively) of other ContinuousState objects, ownership of which is transferred here. More...

~DiagramContinuousState () override

std::unique_ptr< DiagramContinuousStateClone () const
Creates a deep copy of this DiagramContinuousState, with the same substructure but with new, owned data. More...

int num_substates () const

const ContinuousState< T > & get_substate (int index) const
Returns the continuous state at the given index. More...

ContinuousState< T > & get_mutable_substate (int index)
Returns the continuous state at the given index. More...

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

DiagramContinuousStateoperator= (const DiagramContinuousState &)=delete

DiagramContinuousState (DiagramContinuousState &&)=delete

DiagramContinuousStateoperator= (DiagramContinuousState &&)=delete

Public Member Functions inherited from ContinuousState< T >
ContinuousState (std::unique_ptr< VectorBase< T >> state)
Constructs a ContinuousState for a system that does not have second-order structure. More...

ContinuousState (std::unique_ptr< VectorBase< T >> state, int num_q, int num_v, int num_z)
Constructs a ContinuousState that exposes second-order structure. More...

ContinuousState ()
Constructs a zero-length ContinuousState. More...

virtual ~ContinuousState ()

std::unique_ptr< ContinuousState< T > > Clone () const
Creates a deep copy of this object with the same substructure but with all data owned by the copy. More...

int size () const
Returns the size of the entire continuous state vector, which is necessarily num_q + num_v + num_z. More...

int num_q () const
Returns the number of generalized positions q in this state vector. More...

int num_v () const
Returns the number of generalized velocities v in this state vector. More...

int num_z () const
Returns the number of miscellaneous continuous state variables z in this state vector. More...

T & operator[] (std::size_t idx)

const T & operator[] (std::size_t idx) const

const VectorBase< T > & get_vector () const
Returns a reference to the entire continuous state vector. More...

VectorBase< T > & get_mutable_vector ()
Returns a mutable reference to the entire continuous state vector. More...

const VectorBase< T > & get_generalized_position () const
Returns a const reference to the subset of the state vector that is generalized position q. More...

VectorBase< T > & get_mutable_generalized_position ()
Returns a mutable reference to the subset of the state vector that is generalized position q. More...

const VectorBase< T > & get_generalized_velocity () const
Returns a const reference to the subset of the continuous state vector that is generalized velocity v. More...

VectorBase< T > & get_mutable_generalized_velocity ()
Returns a mutable reference to the subset of the continuous state vector that is generalized velocity v. More...

const VectorBase< T > & get_misc_continuous_state () const
Returns a const reference to the subset of the continuous state vector that is other continuous state z. More...

VectorBase< T > & get_mutable_misc_continuous_state ()
Returns a mutable reference to the subset of the continuous state vector that is other continuous state z. More...

void CopyFrom (const ContinuousState< T > &other)
Copies the values from another ContinuousState of the same scalar type into this State. More...

void SetFrom (const ContinuousState< double > &other)
Initializes this ContinuousState (regardless of scalar type) from a State<double>. More...

void SetFromVector (const Eigen::Ref< const VectorX< T >> &value)
Sets the entire continuous state vector from an Eigen expression. More...

VectorX< T > CopyToVector () const
Returns a copy of the entire continuous state vector into an Eigen vector. More...

ContinuousState (const ContinuousState &)=delete

ContinuousStateoperator= (const ContinuousState &)=delete

ContinuousState (ContinuousState &&)=delete

ContinuousStateoperator= (ContinuousState &&)=delete

Protected Member Functions inherited from ContinuousState< T >
ContinuousState (std::unique_ptr< VectorBase< T >> state, std::unique_ptr< VectorBase< T >> q, std::unique_ptr< VectorBase< T >> v, std::unique_ptr< VectorBase< T >> z)
Constructs a continuous state that exposes second-order structure, with no particular constraints on the layout. More...

## Detailed Description

### template<typename T> class drake::systems::DiagramContinuousState< T >

DiagramContinuousState is a ContinuousState consisting of Supervectors xc, q, v, z over the corresponding entries in a set of referenced ContinuousState objects, which may or may not be owned by this DiagramContinuousState.

This is done recursively since any of the referenced ContinuousState objects could themselves be DiagramContinuousState objects. The actual numerical data is always contained in the leaf ContinuousState objects at the bottom of the tree.

This object is used both for a Diagram's actual continuous state variables xc (with partitions q, v, z) and for the time derivatives xdot (qdot, vdot, zdot). Cloning a DiagramContinuousState results in an object with identical structure, but which owns the referenced ContinuousState objects, regardless of whether the original had ownership.

Template Parameters
 T The type of the output data. Must be a valid Eigen scalar.

## Constructor & Destructor Documentation

 DiagramContinuousState ( const DiagramContinuousState< T > & )
delete
 DiagramContinuousState ( DiagramContinuousState< T > && )
delete
 * DiagramContinuousState ( std::vector< ContinuousState< T > * > substates )
inlineexplicit

Constructs a ContinuousState that is composed of other ContinuousStates, which are not owned by this object and must outlive it.

The DiagramContinuousState vector xc = [q v z] will have the same ordering as the substates parameter, which should be the order of the Diagram itself. That is, the substates should be indexed by SubsystemIndex in the same order as the subsystems are.

 DiagramContinuousState ( std::vector< std::unique_ptr< ContinuousState< T >>> substates )
inlineexplicit

Constructs a ContinuousState that is composed (recursively) of other ContinuousState objects, ownership of which is transferred here.

 ~DiagramContinuousState ( )
inlineoverride

## Member Function Documentation

 std::unique_ptr Clone ( ) const
inline

Creates a deep copy of this DiagramContinuousState, with the same substructure but with new, owned data.

Intentionally shadows the ContinuousState::Clone() method but with a more-specific return type so you don't have to downcast.

Here is the call graph for this function:

 ContinuousState& get_mutable_substate ( int index )
inline

Returns the continuous state at the given index.

Aborts if index is out-of-bounds.

Here is the call graph for this function:

 const ContinuousState& get_substate ( int index ) const
inline

Returns the continuous state at the given index.

Aborts if index is out-of-bounds.

Here is the call graph for this function:

Here is the caller graph for this function:

 int num_substates ( ) const
inline

Here is the caller graph for this function:

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

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