Class o80::BackEnd¶
-
template<int QUEUE_SIZE, int NB_ACTUATORS, class STATE, class EXTENDED_STATE>
class BackEnd¶ The backend computes the desired state for each actuator, based on the time series of commands filled up by a frontend. The backend writes information to the time series of observations.
- Template Parameters:
QUEUE_SIZE – number of commands that can be hosted in the command queue at any point of time. Exceptions will be thrown if more commands are queued.
NB_ACTUATORS – number of actuators of the robot
STATE – class encapsulating the state of an actuator of the robot
EXTENDED_STATE – class encapsulating supplementary arbitrary information
Public Types
-
typedef time_series::MultiprocessTimeSeries<Observation<NB_ACTUATORS, STATE, EXTENDED_STATE>> ObservationsTimeSeries¶
Multiprocess time series hosting observations
-
typedef time_series::MultiprocessTimeSeries<int> CompletedCommandsTimeSeries¶
multiprocess times series hosting the commands id that have been processed by the backend
Public Functions
-
BackEnd(std::string segment_id, bool new_commands_observations = false, double period_us = -1)¶
- Parameters:
segment_id – should be the same for the backend and the frontend
new_commands_observations – (default false). If true, information will be writen in the observation only when the desired state of any actuator changed (when false: an observation is writen for each iteration)
period – (default -1) If a positive value, should be the expected period at which the iterate method will be called. It will help improve speed and duration to be more accurate (by relying on the number of iterations rather than the computer clock).
-
~BackEnd()¶
delete the shared memory segments
-
const States<NB_ACTUATORS, STATE> &pulse(const TimePoint &time_now, const States<NB_ACTUATORS, STATE> ¤t_states, const EXTENDED_STATE &extended_state, bool iteration_update = true, long int current_iteration = -1)¶
The backend iterates once.
- Parameters:
time_now – : current time stamp in nanoseconds
current_states – : current state for each actuator
extended_state – : arbitrary information to be added to the Observation that will be writen to the observations time series.
- Returns:
: the desired states for each actuator, based on the current queue of commands
-
bool is_active()¶
returns false if a the last iteration, the previous desired states was returned as such (i.e.
no command is active)
-
void purge()¶
purge all the commands currently queued in the controllers, including the ones currently running.
The purge occurs when the method iterate is called.
-
const States<NB_ACTUATORS, STATE> &initial_states() const¶
returns the first observed states provided (via the first call to the pulse function.
May be usefull for the implementation of reset functions
Private Functions
-
bool iterate(const TimePoint &time_now, const States<NB_ACTUATORS, STATE> ¤t_states, bool iteration_update = true, long int current_iteration = -1)¶
Private Members
-
std::string segment_id_¶
-
ObservationsTimeSeries observations_¶
-
ControllersManager<NB_ACTUATORS, QUEUE_SIZE, STATE> controllers_manager_¶
-
States<NB_ACTUATORS, STATE> desired_states_¶
-
States<NB_ACTUATORS, STATE> initial_states_¶
-
bool first_iteration_¶
-
long int iteration_¶
-
FrequencyMeasure frequency_measure_¶
-
double observed_frequency_¶
-
bool new_commands_observations_¶
-
bool reapplied_desired_states_¶
-
CompletedCommandsTimeSeries waiting_for_completion_¶
-
CompletedCommandsTimeSeries completion_reported_¶