Control Libraries 7.4.0
|
Abstract class to represent a state. More...
#include <State.hpp>
Public Member Functions | |
State () | |
Empty constructor. | |
State (const std::string &name) | |
Constructor with name specification. | |
State (const State &state) | |
Copy constructor from another state. | |
virtual | ~State ()=default |
Virtual destructor. | |
State & | operator= (const State &state) |
Copy assignment operator that has to be defined to the custom assignment operator. | |
const StateType & | get_type () const |
Getter of the type attribute. | |
const std::string & | get_name () const |
Getter of the name attribute. | |
bool | is_empty () const |
Getter of the empty attribute. | |
const std::chrono::time_point< std::chrono::steady_clock > & | get_timestamp () const |
Getter of the timestamp attribute. | |
virtual void | set_name (const std::string &name) |
Setter of the name attribute. | |
void | reset_timestamp () |
Reset the timestamp attribute to now. | |
virtual void | set_data (const Eigen::VectorXd &data) |
Set the data of the state from an Eigen vector. | |
virtual void | set_data (const std::vector< double > &data) |
Set the data of the state from a std vector. | |
virtual void | set_data (const Eigen::MatrixXd &data) |
Set the data of the state from an Eigen matrix. | |
double | get_age () const |
Get the age of the state, i.e. the time since the last modification. | |
virtual bool | is_incompatible (const State &state) const |
Check if the state is incompatible for operations with the state given as argument. | |
bool | is_deprecated (double time_delay) const |
Check if the state is deprecated given a certain time delay. | |
template<typename DurationT > | |
bool | is_deprecated (const std::chrono::duration< int64_t, DurationT > &time_delay) const |
Check if the state is deprecated given a certain time delay. | |
virtual void | reset () |
Reset the object to a post-construction state. | |
operator bool () const noexcept | |
Boolean operator for the truthiness of a state. | |
Protected Member Functions | |
void | set_type (const StateType &type) |
Setter of the state type attribute. | |
void | set_empty (bool empty=true) |
Setter of the empty attribute. | |
void | assert_not_empty () const |
Throw an exception if the state is empty. | |
virtual std::string | to_string () const |
Convert the state to its string representation. | |
Friends | |
void | swap (State &state1, State &state2) |
Swap the values of the two states. | |
std::ostream & | operator<< (std::ostream &os, const State &state) |
Overload the ostream operator for printing. | |
|
explicit |
state_representation::State::State | ( | const State & | state | ) |
|
protected |
Throw an exception if the state is empty.
exceptions::EmptyStateException |
double state_representation::State::get_age | ( | ) | const |
const std::string & state_representation::State::get_name | ( | ) | const |
const std::chrono::time_point< std::chrono::steady_clock > & state_representation::State::get_timestamp | ( | ) | const |
const StateType & state_representation::State::get_type | ( | ) | const |
|
inline |
bool state_representation::State::is_deprecated | ( | double | time_delay | ) | const |
bool state_representation::State::is_empty | ( | ) | const |
|
virtual |
Check if the state is incompatible for operations with the state given as argument.
state | The state to check compatibility with |
Reimplemented in state_representation::IOState< T >, state_representation::IOState< bool >, state_representation::IOState< double >, state_representation::Jacobian, state_representation::JointState, and state_representation::SpatialState.
|
explicitnoexcept |
|
virtual |
Reset the object to a post-construction state.
Reimplemented in py_parameter::ParameterContainer, state_representation::Trajectory< StateT >, state_representation::AnalogIOState, state_representation::DigitalIOState, state_representation::Parameter< T >, state_representation::Parameter< bool >, state_representation::CartesianState, state_representation::Jacobian, and state_representation::JointState.
void state_representation::State::reset_timestamp | ( | ) |
|
virtual |
Set the data of the state from an Eigen matrix.
Reimplemented in state_representation::Jacobian.
|
virtual |
Set the data of the state from an Eigen vector.
Reimplemented in state_representation::Ellipsoid, state_representation::CartesianAcceleration, state_representation::CartesianPose, state_representation::CartesianState, state_representation::CartesianTwist, state_representation::CartesianWrench, state_representation::JointAccelerations, state_representation::JointPositions, state_representation::JointState, state_representation::JointTorques, and state_representation::JointVelocities.
|
virtual |
Set the data of the state from a std vector.
Reimplemented in state_representation::IOState< double >, state_representation::IOState< T >, state_representation::IOState< bool >, state_representation::IOState< double >, state_representation::Ellipsoid, state_representation::CartesianAcceleration, state_representation::CartesianPose, state_representation::CartesianState, state_representation::CartesianTwist, state_representation::CartesianWrench, state_representation::JointAccelerations, state_representation::JointPositions, state_representation::JointState, state_representation::JointTorques, and state_representation::JointVelocities.
|
protected |
|
virtual |
|
protected |
|
protectedvirtual |
Convert the state to its string representation.
Reimplemented in state_representation::AnalogIOState, state_representation::DigitalIOState, state_representation::Shape, state_representation::CartesianState, state_representation::JointState, and state_representation::SpatialState.
|
friend |