File standalone.hpp¶
-
namespace o80
Functions
-
void please_stop(std::string segment_id)¶
! if an instance of Standalone of the related segment_id is running, will send a stop request to this standalone.
-
template<class RobotDriver, class o80Standalone, typename ...Args>
void start_action_timed_standalone(std::string segment_id, double frequency, bool bursting, Args&&... args)¶
-
template<class RobotDriver, class o80Standalone, typename ...Args>
void start_standalone(std::string segment_id, double frequency, bool bursting, Args&&... args)¶ instantiates instances of (robot_interfaces) RobotDriver and of (o80) Standalone, and starts them in a thread.
A runtime exception is thrown if another standalone of the same segment_id has already been started. tparam Args template arguments of the driver param segment id o80 BackEnd segment id param frequency frequency at which the standalone will iterate (non bursting mode) param bursting if true, will run in bursting mode, i.e. the standalone will iterate only when the o80 frontend calls its burst function. param args arguments for the driver
-
void stop_standalone(std::string segment_id)¶
! Stop the standalone of the specified segment_id.
A runtime error is thrown if no such standalone is running.
-
bool standalone_is_running(std::string segment_id)¶
! Returns true if the standalone is iterating.
(returns also false if the standalone does not exist)
-
template<int QUEUE_SIZE, int NB_ACTUATORS, class DRIVER, class o80_STATE, class o80_EXTENDED_STATE>
class Standalone - #include <standalone.hpp>
! A Standalone encapsulates and organize the the communication between a (robot_interfaces) driver, a (robot_interfaces) frontend, a (robot_interfaces) backend and a (o80) backend : at each iteration, information about the current state of the robot actuators are passed by the frontend to the backend, which passes to the driver desired states values.
- tparam 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.
- tparam NB_ACTUATORS
number of actuators of the robot
- tparam RI_ACTION
template to the (robot_interfaces) frontend
- tparam ROBOT_OUT
template to the (robot_interfaces) frontend
- tparam o80_STATE
- tparam EXTENDED_STATE
class encapsulating supplementary arbitrary information (i.e. supplementary to the current actuators state) that will be sent from the (robot_interfaces) frontend to the backend (which will add these information to the observations)
Public Types
-
typedef std::shared_ptr<DRIVER> DriverPtr
-
typedef o80_STATE o80State
-
typedef o80_EXTENDED_STATE o80ExtendedState
-
typedef DRIVER o80DRIVER
Public Functions
-
Standalone(DriverPtr driver_ptr, double frequency, std::string segment_id)
Creates instances of:
-
~Standalone()
-
void start()
! Starts the robot interfaces backend
-
void stop()
! Stops the robot interfaces backend
-
bool spin(bool bursting = false)
! - If bursting is false, performs one iteration and then wait for the time requied to match the desired frequency.
-
bool spin(o80_EXTENDED_STATE &extended_state, bool bursting = false)
! Similar to spin, and the extended state is added to the observation that is written to the shared memory by the o80 BackEnd.
-
virtual o80::States<NB_ACTUATORS, o80_STATE> convert(const typename DRIVER::DRIVER_OUT &observation) = 0
! user code to convert the observation read from robot_interfaces frontend into the current o80 States.
-
virtual DRIVER::DRIVER_IN convert(const o80::States<NB_ACTUATORS, o80_STATE> &states) = 0
! user code to convert the desired states generated by the o80 BackEnd into action required by the robot_interfaces frontend.
-
inline virtual void enrich_extended_state(o80_EXTENDED_STATE &extended_state, const typename DRIVER::DRIVER_OUT &observation)
! converts the observation as returned by the robot_interfaces frontend into the o80 extended state (optional)
Public Static Attributes
-
static constexpr int queue_size = QUEUE_SIZE
-
static constexpr int nb_actuators = NB_ACTUATORS
Private Types
-
typedef BackEnd<QUEUE_SIZE, NB_ACTUATORS, o80_STATE, o80_EXTENDED_STATE> o80Backend
Private Functions
-
bool iterate(const TimePoint &time_now, o80_EXTENDED_STATE &extended_state)
Private Members
-
double frequency_
-
Microseconds period_
-
FrequencyManager frequency_manager_
-
TimePoint now_
-
std::shared_ptr<Burster> burster_
-
std::string segment_id_
-
DriverPtr driver_ptr_
-
o80Backend o8o_backend_
-
void please_stop(std::string segment_id)¶