Drake
ContinuousState< T > Class Template Reference

ContinuousState is a container for all the continuous state variables xc. More...

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

Inheritance diagram for ContinuousState< T >:
[legend]

Public Member Functions

 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 ()
 
int size () const
 Returns the size of the entire continuous state vector. More...
 
T & operator[] (std::size_t idx)
 
const T & operator[] (std::size_t idx) const
 
const VectorBase< T > & get_vector () const
 Returns the entire continuous state vector. More...
 
VectorBase< T > * get_mutable_vector ()
 Returns a mutable pointer to the entire continuous state vector, which is never nullptr. More...
 
const VectorBase< T > & get_generalized_position () const
 Returns the subset of the state vector that is generalized position q. More...
 
VectorBase< T > * get_mutable_generalized_position ()
 Returns a mutable pointer to the subset of the state vector that is generalized position q. More...
 
const VectorBase< T > & get_generalized_velocity () const
 Returns the subset of the continuous state vector that is generalized velocity v. More...
 
VectorBase< T > * get_mutable_generalized_velocity ()
 Returns a mutable pointer to the subset of the continuous state vector that is generalized velocity v. More...
 
const VectorBase< T > & get_misc_continuous_state () const
 Returns the subset of the continuous state vector that is other continuous state z. More...
 
VectorBase< T > * get_mutable_misc_continuous_state ()
 Returns a mutable pointer 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...
 
Does not allow copy, move, or assignment
 ContinuousState (const ContinuousState &)=delete
 
ContinuousStateoperator= (const ContinuousState &)=delete
 
 ContinuousState (ContinuousState &&)=delete
 
ContinuousStateoperator= (ContinuousState &&)=delete
 

Protected Member Functions

 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::ContinuousState< T >

ContinuousState is a container for all the continuous state variables xc.

Continuous state variables are those whose values are defined by differential equations, so we expect there to be a well-defined time derivative xcdotd/dt xc.

The contents of xc are conceptually partitioned into three groups:

         |------- xc ------|
(index 0)|--q--|--v--|--z--|(index xc.size() - 1)
Where q is generalized position
      v is generalized velocity
      z is other continuous state

Any of the groups may be empty. However, groups q and v must be either both present or both empty, because the time derivative qdot of the second-order state variables q must be computable using a linear mapping qdot=N(q)*v.

The time derivative xcdot has the identical substructure to xc, with the partitions interpreted as qdot, vdot, and zdot. We use identical ContinuousState objects for both.

Template Parameters
TA mathematical type compatible with Eigen's Scalar.

Constructor & Destructor Documentation

ContinuousState ( const ContinuousState< T > &  )
delete
ContinuousState ( ContinuousState< T > &&  )
delete
ContinuousState ( std::unique_ptr< VectorBase< T >>  state)
inlineexplicit

Constructs a ContinuousState for a system that does not have second-order structure.

The q and v partitions are empty; all of the state xc is miscellaneous continuous state z.

ContinuousState ( std::unique_ptr< VectorBase< T >>  state,
int  num_q,
int  num_v,
int  num_z 
)
inline

Constructs a ContinuousState that exposes second-order structure.

Parameters
stateThe source xc of continuous state information.
num_qThe number of position variables q.
num_vThe number of velocity variables v.
num_zThe number of other continuous variables z.

We require that num_q ≥ num_v and that the sum of the partition sizes adds up to the size of state.

ContinuousState ( )
inline

Constructs a zero-length ContinuousState.

virtual ~ContinuousState ( )
inlinevirtual
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 
)
inlineprotected

Constructs a continuous state that exposes second-order structure, with no particular constraints on the layout.

Precondition
The q, v, z are all views into the same storage as state.
Parameters
stateThe entire continuous state.
qThe subset of state that is generalized position.
vThe subset of state that is generalized velocity.
zThe subset of state that is neither position nor velocity.

Member Function Documentation

void CopyFrom ( const ContinuousState< T > &  other)
inline

Copies the values from another ContinuousState of the same scalar type into this State.

VectorX<T> CopyToVector ( ) const
inline

Returns a copy of the entire continuous state vector into an Eigen vector.

Here is the caller graph for this function:

const VectorBase<T>& get_generalized_position ( ) const
inline

Returns the subset of the state vector that is generalized position q.

Here is the caller graph for this function:

const VectorBase<T>& get_generalized_velocity ( ) const
inline

Returns the subset of the continuous state vector that is generalized velocity v.

Here is the caller graph for this function:

const VectorBase<T>& get_misc_continuous_state ( ) const
inline

Returns the subset of the continuous state vector that is other continuous state z.

Here is the caller graph for this function:

VectorBase<T>* get_mutable_generalized_position ( )
inline

Returns a mutable pointer to the subset of the state vector that is generalized position q.

Here is the caller graph for this function:

VectorBase<T>* get_mutable_generalized_velocity ( )
inline

Returns a mutable pointer to the subset of the continuous state vector that is generalized velocity v.

Here is the caller graph for this function:

VectorBase<T>* get_mutable_misc_continuous_state ( )
inline

Returns a mutable pointer to the subset of the continuous state vector that is other continuous state z.

Here is the caller graph for this function:

VectorBase<T>* get_mutable_vector ( )
inline

Returns a mutable pointer to the entire continuous state vector, which is never nullptr.

Here is the caller graph for this function:

const VectorBase<T>& get_vector ( ) const
inline

Returns the entire continuous state vector.

Here is the caller graph for this function:

ContinuousState& operator= ( ContinuousState< T > &&  )
delete
ContinuousState& operator= ( const ContinuousState< T > &  )
delete
T& operator[] ( std::size_t  idx)
inline
const T& operator[] ( std::size_t  idx) const
inline
void SetFrom ( const ContinuousState< double > &  other)
inline

Initializes this ContinuousState (regardless of scalar type) from a State<double>.

All scalar types in Drake must support initialization from doubles.

void SetFromVector ( const Eigen::Ref< const VectorX< T >> &  value)
inline

Sets the entire continuous state vector from an Eigen expression.

Here is the caller graph for this function:

int size ( ) const
inline

Returns the size of the entire continuous state vector.

Here is the caller graph for this function:


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