Control Libraries 7.4.0
|
Public Member Functions | |
AnalogIOState () | |
Empty constructor for an analog IO state. | |
AnalogIOState (const std::string &name, unsigned int nb_ios=0) | |
Constructor with name and number of analog IOs provided. | |
AnalogIOState (const std::string &name, const std::vector< std::string > &io_names) | |
Constructor with name and list of analog IO names provided. | |
AnalogIOState (const AnalogIOState &state) | |
Copy constructor of an analog IO state. | |
AnalogIOState & | operator= (const AnalogIOState &state) |
Copy assignment operator that has to be defined to the custom assignment operator. | |
AnalogIOState | copy () const |
Return a copy of the analog IO state. | |
void | reset () override |
Reset the object to a post-construction state. | |
void | set_zero () |
Set the analog IO state to zero data. | |
Public Member Functions inherited from state_representation::IOState< double > | |
unsigned int | get_size () const |
Getter of the size. | |
const std::vector< std::string > & | get_names () const |
Getter of the names. | |
unsigned int | get_io_index (const std::string &io_name) const |
Get IO index by the name of the IO, if it exists. | |
double | get_value (const std::string &name) const |
Get the value of an IO by its name, if it exists. | |
double | get_value (unsigned int io_index) const |
Get the value of an IO by its index, if it exists. | |
Eigen::Vector< double, Eigen::Dynamic > | data () const |
Returns the values of the IO state as an Eigen vector. | |
Eigen::Array< double, Eigen::Dynamic, 1 > | array () const |
Returns the values of the IO state an Eigen array. | |
void | set_names (unsigned int nb_ios) |
Setter of the names from the number of IOs. | |
void | set_names (const std::vector< std::string > &names) |
Setter of the names from a list of IO names. | |
void | set_value (double value, const std::string &name) |
Set the value of an IO by its name. | |
void | set_value (double value, unsigned int io_index) |
Set the value of an IO by its index. | |
void | set_data (const Eigen::Vector< double, Eigen::Dynamic > &data) |
Set the values of the IO state from a single Eigen vector. | |
void | set_data (const std::vector< double > &data) |
Set the values of the IO state from a single std vector. | |
void | set_data (const std::vector< double > &data) |
Set the data of the state from a std vector. | |
void | set_data (const std::vector< bool > &data) |
bool | is_incompatible (const State &state) const override |
Check if the IO group is incompatible for operations with the state given as argument. | |
std::vector< double > | to_std_vector () const |
Return the IO values as a std vector. | |
std::vector< double > | to_std_vector () const |
std::vector< bool > | to_std_vector () const |
Public Member Functions inherited from state_representation::State | |
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 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. | |
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. | |
operator bool () const noexcept | |
Boolean operator for the truthiness of a state. | |
Static Public Member Functions | |
static AnalogIOState | Zero (const std::string &name, unsigned int nb_ios) |
Constructor for a zero analog IO state. | |
static AnalogIOState | Zero (const std::string &name, const std::vector< std::string > &names) |
Constructor for a zero analog IO state. | |
static AnalogIOState | Random (const std::string &name, unsigned int nb_ios) |
Constructor for an analog IO state with random data. | |
static AnalogIOState | Random (const std::string &name, const std::vector< std::string > &names) |
Constructor for an analog IO state with random data. | |
Protected Member Functions | |
std::string | to_string () const override |
Convert the state to its string representation. | |
Protected Member Functions inherited from state_representation::IOState< double > | |
IOState ()=default | |
Empty constructor for an IO state. | |
IOState (const std::string &name, unsigned int nb_ios) | |
Constructor with name and number of IOs provided. | |
IOState (const std::string &name, const std::vector< std::string > &io_names) | |
Constructor with name and list of IO names provided. | |
Protected Member Functions inherited from state_representation::State | |
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. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const AnalogIOState &state) |
Overload the ostream operator for printing. | |
void | swap (AnalogIOState &state1, AnalogIOState &state2) |
Swap the values of the IO states. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from state_representation::IOState< double > | |
static void | assert_index_in_range (unsigned int io_index, unsigned int size) |
Protected Attributes inherited from state_representation::IOState< double > | |
std::vector< std::string > | names_ |
names of the IOs | |
Eigen::Vector< double, Eigen::Dynamic > | data_ |
IO values. | |
Definition at line 7 of file AnalogIOState.hpp.
state_representation::AnalogIOState::AnalogIOState | ( | ) |
Empty constructor for an analog IO state.
Definition at line 9 of file AnalogIOState.cpp.
|
explicit |
Constructor with name and number of analog IOs provided.
name | The name of the associated IO state |
nb_ios | The number of IOs for initialization |
Definition at line 13 of file AnalogIOState.cpp.
state_representation::AnalogIOState::AnalogIOState | ( | const std::string & | name, |
const std::vector< std::string > & | io_names | ||
) |
Constructor with name and list of analog IO names provided.
name | The name of the associated analog IO state |
io_name | List of IO names |
Definition at line 18 of file AnalogIOState.cpp.
state_representation::AnalogIOState::AnalogIOState | ( | const AnalogIOState & | state | ) |
Copy constructor of an analog IO state.
state | The analog IO state to copy from |
Definition at line 23 of file AnalogIOState.cpp.
AnalogIOState state_representation::AnalogIOState::copy | ( | ) | const |
Return a copy of the analog IO state.
Definition at line 63 of file AnalogIOState.cpp.
AnalogIOState & state_representation::AnalogIOState::operator= | ( | const AnalogIOState & | state | ) |
Copy assignment operator that has to be defined to the custom assignment operator.
state | The state with value to assign |
Definition at line 57 of file AnalogIOState.cpp.
|
static |
Constructor for an analog IO state with random data.
name | The name of the associated analog IO state |
names | List of IO names |
Definition at line 50 of file AnalogIOState.cpp.
|
static |
Constructor for an analog IO state with random data.
name | The name of the associated analog IO state |
nb_ios | The number of analog IOs for initialization |
Definition at line 43 of file AnalogIOState.cpp.
|
overridevirtual |
Reset the object to a post-construction state.
Reimplemented from state_representation::State.
Definition at line 68 of file AnalogIOState.cpp.
void state_representation::AnalogIOState::set_zero | ( | ) |
Set the analog IO state to zero data.
Definition at line 73 of file AnalogIOState.cpp.
|
overrideprotectedvirtual |
Convert the state to its string representation.
Reimplemented from state_representation::State.
Definition at line 80 of file AnalogIOState.cpp.
|
static |
Constructor for a zero analog IO state.
name | The name of the associated analog IO state |
names | List of IO names |
Definition at line 36 of file AnalogIOState.cpp.
|
static |
Constructor for a zero analog IO state.
name | The name of the associated analog IO state |
nb_ios | The number of analog IOs for initialization |
Definition at line 29 of file AnalogIOState.cpp.
|
friend |
Overload the ostream operator for printing.
os | The ostream to append the string representing the state to |
state | The spatial state to print |
Definition at line 95 of file AnalogIOState.cpp.
|
friend |
Swap the values of the IO states.
state1 | IO state to be swapped with 2 |
state2 | IO state to be swapped with 1 |
Definition at line 111 of file AnalogIOState.hpp.