1#include "state_representation/AnalogIOState.hpp"
3#include "state_representation/exceptions/IONotFoundException.hpp"
5using namespace state_representation::exceptions;
10 this->
set_type(StateType::ANALOG_IO_STATE);
14 this->
set_type(StateType::ANALOG_IO_STATE);
15 this->
data_ = Eigen::VectorXd::Zero(nb_ios);
75 this->
data_.setZero();
83 s << std::endl <<
"analog io names: [";
84 for (
auto& n : this->
get_names()) { s << n <<
", "; }
89 s << std::endl <<
"values: [";
90 for (
auto& p : this->
data()) { s << p <<
", "; }
96 os << state.to_string();
void reset() override
Reset the object to a post-construction state.
static AnalogIOState Zero(const std::string &name, unsigned int nb_ios)
Constructor for a zero analog IO state.
std::string to_string() const override
Convert the state to its string representation.
AnalogIOState()
Empty constructor for an analog IO state.
friend void swap(AnalogIOState &state1, AnalogIOState &state2)
Swap the values of the IO states.
void set_zero()
Set the analog IO state to zero data.
AnalogIOState copy() const
Return a copy of the analog IO state.
AnalogIOState & operator=(const AnalogIOState &state)
Copy assignment operator that has to be defined to the custom assignment operator.
static AnalogIOState Random(const std::string &name, unsigned int nb_ios)
Constructor for an analog IO state with random data.
Eigen::Vector< double, Eigen::Dynamic > data_
IO values.
void set_data(const Eigen::Vector< double, Eigen::Dynamic > &data)
Set the values of the IO state from a single Eigen vector.
Eigen::Vector< T, Eigen::Dynamic > data() const
Returns the values of the IO state as an Eigen vector.
void set_names(unsigned int nb_ios)
Setter of the names from the number of IOs.
unsigned int get_size() const
Getter of the size.
const std::vector< std::string > & get_names() const
Getter of the names.
void set_type(const StateType &type)
Setter of the state type attribute.
virtual std::string to_string() const
Convert the state to its string representation.
virtual void reset()
Reset the object to a post-construction state.
bool is_empty() const
Getter of the empty attribute.
void set_empty(bool empty=true)
Setter of the empty attribute.
Core state variables and objects.
std::ostream & operator<<(std::ostream &os, const AnalogIOState &state)