27 state_ = std::move(state);
30 misc_continuous_state_.reset(
49 int num_v,
int num_z) {
50 state_ = std::move(state);
51 if (state_->size() != num_q + num_v + num_z) {
52 throw std::out_of_range(
54 "cannot be partitioned as" +
" q " +
std::to_string(num_q) +
" v " +
58 throw std::logic_error(
"Number of velocity variables " +
60 " must not exceed number of position variables " +
64 generalized_velocity_.reset(
66 misc_continuous_state_.reset(
81 return *generalized_position_;
87 return generalized_position_.get();
92 return *generalized_velocity_;
98 return generalized_velocity_.get();
103 return *misc_continuous_state_;
109 return misc_continuous_state_.get();
114 std::unique_ptr<StateVector<T>> state_;
119 std::unique_ptr<StateVector<T>> generalized_position_;
125 std::unique_ptr<StateVector<T>> generalized_velocity_;
130 std::unique_ptr<StateVector<T>> misc_continuous_state_;
139 template <
typename T>
StateVector< T > * get_mutable_state()
Returns a mutable pointer to the entire state vector, never null.
Definition: state.h:77
const StateVector< T > & get_misc_continuous_state() const
Returns the subset of the state vector that is other continuous state z.
Definition: state.h:102
std::unique_ptr< ContinuousState< T > > continuous_state
Definition: state.h:141
Definition: constants.h:3
const StateVector< T > & get_generalized_position() const
Returns the subset of the state vector that is generalized position q.
Definition: state.h:80
StateVector is an abstract base class template for vector quantities within the state of a System...
Definition: state_vector.h:20
const StateVector< T > & get_state() const
Returns the entire state vector.
Definition: state.h:74
StateVector< T > * get_mutable_generalized_position()
Returns a mutable pointer to the subset of the state vector that is generalized position q...
Definition: state.h:86
const StateVector< T > & get_generalized_velocity() const
Returns the subset of the state vector that is generalized velocity v.
Definition: state.h:91
StateSubvector is a concrete class template that implements StateVector by providing a sliced view of...
Definition: state_subvector.h:19
std::string to_string(const Eigen::MatrixBase< Derived > &a)
Definition: testUtil.h:29
The State is a container for all the data comprising the complete state of a particular System at a p...
Definition: state.h:140
ContinuousState(std::unique_ptr< StateVector< T >> state, int num_q, int num_v, int num_z)
Constructs a ContinuousState that exposes second-order structure.
Definition: state.h:48
The ContinuousState is a container for all the State variables that are unique to continuous Systems...
Definition: state.h:22
ContinuousState(std::unique_ptr< StateVector< T >> state)
Constructs a ContinuousState for a system that does not have second-order structure: All of the state...
Definition: state.h:26
StateVector< T > * get_mutable_generalized_velocity()
Returns a mutable pointer to the subset of the state vector that is generalized velocity v...
Definition: state.h:97
StateVector< T > * get_mutable_misc_continuous_state()
Returns a mutable pointer to the subset of the state vector that is other continuous state z...
Definition: state.h:108