Control Libraries 6.3.4
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
state_representation::State Class Reference

Abstract class to represent a state. More...

#include <State.hpp>

Inheritance diagram for state_representation::State:
state_representation::Jacobian state_representation::JointState state_representation::ParameterInterface state_representation::Shape state_representation::SpatialState state_representation::Trajectory< StateT > state_representation::JointAccelerations state_representation::JointPositions state_representation::JointTorques state_representation::JointVelocities state_representation::Parameter< bool > py_parameter::ParameterContainer state_representation::Parameter< T > state_representation::Ellipsoid state_representation::CartesianState state_representation::DualQuaternionState

Public Member Functions

 State ()
 Empty constructor. More...
 
 State (const StateType &type)
 Constructor only specifying the type of the state from the StateType enumeration. More...
 
 State (const StateType &type, const std::string &name, const bool &empty=true)
 Constructor with name specification. More...
 
 State (const State &state)
 Copy constructor from another State. More...
 
virtual ~State ()=default
 Virtual destructor.
 
Stateoperator= (const State &state)
 Copy assignment operator that have to be defined to the custom assignment operator. More...
 
const StateTypeget_type () const
 Getter of the type attribute. More...
 
bool is_empty () const
 Getter of the empty attribute. More...
 
void set_empty (bool empty=true)
 Setter of the empty attribute. More...
 
void set_filled ()
 Setter of the empty attribute to false and also reset the timestamp. More...
 
const std::chrono::time_point< std::chrono::steady_clock > & get_timestamp () const
 Getter of the timestamp attribute. More...
 
void set_timestamp (const std::chrono::time_point< std::chrono::steady_clock > &timepoint)
 Setter of the timestamp attribute. More...
 
void reset_timestamp ()
 Reset the timestamp attribute to now. More...
 
const std::string & get_name () const
 Getter of the name as const reference. More...
 
virtual void set_name (const std::string &name)
 Setter of the name. More...
 
template<typename DurationT >
bool is_deprecated (const std::chrono::duration< int64_t, DurationT > &time_delay)
 Check if the state is deprecated given a certain time delay. More...
 
virtual bool is_compatible (const State &state) const
 Check if the state is compatible for operations with the state given as argument. More...
 
virtual void initialize ()
 Initialize the State to a zero value. More...
 
virtual void set_data (const Eigen::VectorXd &data)
 Set the data of the state from a single Eigen vector. More...
 
virtual void set_data (const std::vector< double > &data)
 Set the data of the state from a single std vector. More...
 
virtual void set_data (const Eigen::MatrixXd &data)
 Set the data of the state from an Eigen matrix. More...
 
 operator bool () const noexcept
 Boolean operator for the truthiness of a state. More...
 

Protected Member Functions

void set_type (const StateType &type)
 Override the state type. More...
 

Friends

void swap (State &state1, State &state2)
 Swap the values of the two States. More...
 
std::ostream & operator<< (std::ostream &os, const State &state)
 Overload the ostream operator for printing. More...
 

Detailed Description

Abstract class to represent a state.

Definition at line 25 of file State.hpp.

Constructor & Destructor Documentation

◆ State() [1/4]

state_representation::State::State ( )
explicit

Empty constructor.

Definition at line 5 of file State.cpp.

◆ State() [2/4]

state_representation::State::State ( const StateType type)
explicit

Constructor only specifying the type of the state from the StateType enumeration.

Parameters
typethe type of State

Definition at line 7 of file State.cpp.

◆ State() [3/4]

state_representation::State::State ( const StateType type,
const std::string &  name,
const bool &  empty = true 
)
explicit

Constructor with name specification.

Parameters
typethe type of State
namethe name of the State
emptyspecify if the state is initialized as empty, default true

Definition at line 9 of file State.cpp.

◆ State() [4/4]

state_representation::State::State ( const State state)

Copy constructor from another State.

Definition at line 12 of file State.cpp.

Member Function Documentation

◆ get_name()

const std::string & state_representation::State::get_name ( ) const

Getter of the name as const reference.

Definition at line 48 of file State.cpp.

◆ get_timestamp()

const std::chrono::time_point< std::chrono::steady_clock > & state_representation::State::get_timestamp ( ) const

Getter of the timestamp attribute.

Definition at line 36 of file State.cpp.

◆ get_type()

const StateType & state_representation::State::get_type ( ) const

Getter of the type attribute.

Returns
the type of the State

Definition at line 19 of file State.cpp.

◆ initialize()

void state_representation::State::initialize ( )
virtual

◆ is_compatible()

bool state_representation::State::is_compatible ( const State state) const
virtual

Check if the state is compatible for operations with the state given as argument.

Parameters
statethe state to check compatibility with

Reimplemented in state_representation::JointState, state_representation::Jacobian, and state_representation::SpatialState.

Definition at line 56 of file State.cpp.

◆ is_deprecated()

template<typename DurationT >
bool state_representation::State::is_deprecated ( const std::chrono::duration< int64_t, DurationT > &  time_delay)
inline

Check if the state is deprecated given a certain time delay.

Parameters
time_delaythe time after which to consider the state as deprecated

Definition at line 196 of file State.hpp.

◆ is_empty()

bool state_representation::State::is_empty ( ) const

Getter of the empty attribute.

Definition at line 23 of file State.cpp.

◆ operator bool()

state_representation::State::operator bool ( ) const
explicitnoexcept

Boolean operator for the truthiness of a state.

Returns
False if the state is empty, true otherwise

Definition at line 85 of file State.cpp.

◆ operator=()

State & state_representation::State::operator= ( const State state)
inline

Copy assignment operator that have to be defined to the custom assignment operator.

Parameters
statethe state with value to assign
Returns
reference to the current state with new values

Definition at line 189 of file State.hpp.

◆ reset_timestamp()

void state_representation::State::reset_timestamp ( )

Reset the timestamp attribute to now.

Definition at line 44 of file State.cpp.

◆ set_data() [1/3]

void state_representation::State::set_data ( const Eigen::MatrixXd &  data)
virtual

Set the data of the state from an Eigen matrix.

Parameters
thedata vector

Reimplemented in state_representation::Jacobian.

Definition at line 73 of file State.cpp.

◆ set_data() [2/3]

void state_representation::State::set_data ( const Eigen::VectorXd &  data)
virtual

◆ set_data() [3/3]

void state_representation::State::set_data ( const std::vector< double > &  data)
virtual

◆ set_empty()

void state_representation::State::set_empty ( bool  empty = true)

Setter of the empty attribute.

Parameters
emptybool if the state should be empty or not (default is true)

Definition at line 27 of file State.cpp.

◆ set_filled()

void state_representation::State::set_filled ( )

Setter of the empty attribute to false and also reset the timestamp.

Definition at line 31 of file State.cpp.

◆ set_name()

void state_representation::State::set_name ( const std::string &  name)
virtual

Setter of the name.

Definition at line 52 of file State.cpp.

◆ set_timestamp()

void state_representation::State::set_timestamp ( const std::chrono::time_point< std::chrono::steady_clock > &  timepoint)

Setter of the timestamp attribute.

Parameters
timepointthe new value for the timestamp

Definition at line 40 of file State.cpp.

◆ set_type()

void state_representation::State::set_type ( const StateType type)
protected

Override the state type.

Parameters
typethe type of the state to set

Definition at line 89 of file State.cpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const State state 
)
friend

Overload the ostream operator for printing.

Parameters
osthe ostream to append the string representing the State to
statethe State to print
Returns
the appended ostream

Definition at line 77 of file State.cpp.

◆ swap

void swap ( State state1,
State state2 
)
friend

Swap the values of the two States.

Parameters
state1State to be swapped with 2
state2State to be swapped with 1

Definition at line 182 of file State.hpp.


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