File observation.hpp

namespace o80
template<int NB_ACTUATORS, class ROBOT_STATE, class EXTENDED_STATE>
class Observation
#include <observation.hpp>

! Encapsulate the current robot state, the desired robot state and an optional extended state.

It also encapsulate the current iteration, frequency and time stamp. Observations are created and written in the share memory by instances of BackEnd at each iteration, and read from the shared memory by instances of FrontEnd.

tparam NB_ACTUATORS

the number of actuators of the robot

tparam ROBOT_STATE

the class used to encapsulate robot states

tparam EXTENDED_STATE

arbitrary class used to encapsulate arbitrary information

Public Functions

Observation()
void copy(const Observation<NB_ACTUATORS, ROBOT_STATE, EXTENDED_STATE> &from, bool full)

copy the control iteration, sensor iteration and observed frequency from this to from. If full, also copies observed_states, desired_states, extended_states and time stamp.

Observation(const Observation<NB_ACTUATORS, ROBOT_STATE, EXTENDED_STATE> &other)
Observation(Observation<NB_ACTUATORS, ROBOT_STATE, EXTENDED_STATE> &&other) noexcept
Observation<NB_ACTUATORS, ROBOT_STATE, EXTENDED_STATE> &operator=(const Observation<NB_ACTUATORS, ROBOT_STATE, EXTENDED_STATE> &other)
Observation<NB_ACTUATORS, ROBOT_STATE, EXTENDED_STATE> &operator=(Observation<NB_ACTUATORS, ROBOT_STATE, EXTENDED_STATE> &&other) noexcept
Observation(States<NB_ACTUATORS, ROBOT_STATE> observed_state, States<NB_ACTUATORS, ROBOT_STATE> desired_state, long int stamp, long int iteration, double frequency)
Observation(States<NB_ACTUATORS, ROBOT_STATE> observed_state, States<NB_ACTUATORS, ROBOT_STATE> desired_state, long int stamp, long int control_iteration, long int sensor_iteration, double frequency)
Observation(States<NB_ACTUATORS, ROBOT_STATE> observed_state, States<NB_ACTUATORS, ROBOT_STATE> desired_state, EXTENDED_STATE extended_state, long int stamp, long int iteration, double frequency)
Observation(States<NB_ACTUATORS, ROBOT_STATE> observed_state, States<NB_ACTUATORS, ROBOT_STATE> desired_state, EXTENDED_STATE extended_state, long int stamp, long int control_iteration, long int sensor_iteration, double frequency)
const States<NB_ACTUATORS, ROBOT_STATE> &get_observed_states() const

returns the actual state of each actuator

const States<NB_ACTUATORS, ROBOT_STATE> &get_desired_states() const

returns the desired state of each actuator, as computed by the backend based on the command queue, and set to the robot

const EXTENDED_STATE &get_extended_state() const

returns an instance of extended state, which is an instance of an arbitrary class encaspulating arbitrary information

long int get_control_iteration() const

robot control iteration corresponding to this observation

long int get_sensor_iteration() const

robot sensor iteration corresponding to this observation

long int get_iteration() const

backend iteration corresponding to this observation

double get_frequency() const

frequency of backend at the iteration this observation was created

long int get_time_stamp() const

time stamp of the observation (in nanoseconds)

std::string to_string() const

returns a string description of the observation

template<class Archive>
inline void serialize(Archive &archive)

used internally to serialize the instances of observation when written in the shared memory

Protected Attributes

States<NB_ACTUATORS, ROBOT_STATE> observed_states_
States<NB_ACTUATORS, ROBOT_STATE> desired_states_
EXTENDED_STATE extended_state_
long int control_iteration_
long int sensor_iteration_
long int stamp_
long int iteration_
double observed_frequency_