Class util_hfsm

Inheritance Relationships

Base Types

Class Documentation

class util_hfsm : public rpfsm::hfsm, public rer::client<util_hfsm>, public cosm::spatial::metrics::interference_metrics, public cosm::spatial::metrics::nest_zone_metrics

A collection of base states/common functionality that robot FSMs which operate in strict 2D or quasi-3D can use if they choose (NOT full 3D robots).

This class cannot be instantiated on its own, as does not define an FSM per-se.

Public Functions

util_hfsm(const fsm_params *params, rmath::rng *rng, uint8_t max_states)
util_hfsm(const util_hfsm&) = delete
~util_hfsm(void) override = default
csubsystem::actuation_subsystem *actuation(void)
csubsystem::actuation_subsystem *actuation(void) const
inline virtual auto entered_interference(void) const -> decltype(std::declval<decltype(*m_inta_tracker)>().entered_interference()) override

If TRUE, then a robot has just begun experiencing inter-robot interference. This should return FALSE on all subsequent steps the robot is experiencing interference.

inline virtual auto entered_nest(void) const -> decltype(std::declval<decltype(*m_nz_tracker)>().entered_nest()) override

If TRUE, then a robot has just begun entered the nest. This should return FALSE on all subsequent steps the robot is in the nest.

inline virtual auto exited_interference(void) const -> decltype(std::declval<decltype(*m_inta_tracker)>().exited_interference()) override

If TRUE, then a robot has just exited interference avoidance. This should return FALSE on all previous steps the robot is in interference avoidance, and all steps afterwards when it returns to normal operation.

inline virtual auto exited_nest(void) const -> decltype(std::declval<decltype(*m_nz_tracker)>().exited_nest()) override

If TRUE, then a robot has just exited the nest. This should return FALSE on all previous steps the robot is in the nest, and all steps afterwards.

inline virtual auto exp_interference(void) const -> decltype(std::declval<decltype(*m_inta_tracker)>().exp_interference()) override

If TRUE, then a robot is currently experiencing inter-robot interference.

inline virtual auto in_nest(void) const -> decltype(std::declval<decltype(*m_nz_tracker)>().in_nest()) override

If TRUE, then a robot is currently in the nest.

void init(void) override
inline const interference_tracker *inta_tracker(void) const

Handle to internal interference tracker; provided as a common utility to derived classes that do not utilize/wrap a spatial::strategy::base_strategy which has its own tracker.

inline virtual auto interference_duration(void) const -> decltype(std::declval<decltype(*m_inta_tracker)>().interference_duration()) override

If exited_interference() returns TRUE, then this should return the duration of the interference in timesteps.

inline virtual auto interference_loc3D(void) const -> decltype(std::declval<decltype(*m_inta_tracker)>().interference_loc3D()) override

When exp_interference() returns TRUE, then this should return the robot’s current discrete position in 3D.

inline virtual auto nest_duration(void) const -> decltype(std::declval<decltype(*m_nz_tracker)>().nest_duration()) override

If exited_nest() returns TRUE, then this should return the # timesteps the robot was in the nest.

inline virtual auto nest_entry_time(void) const -> decltype(std::declval<decltype(*m_nz_tracker)>().nest_entry_time()) override

If entered_nest() returns TRUE, then this should return the current timestep.

inline const nest_zone_tracker *nz_tracker(void) const

Handle to internal nest zone tracker; provided as a common utility to derived classes that do not utilize/wrap a spatial::strategy::base_strategy which has its own tracker.

util_hfsm &operator=(const util_hfsm&) = delete
csubsystem::sensing_subsystem *sensing(void)
const csubsystem::sensing_subsystem *sensing(void) const

Protected Functions

inline interference_tracker *inta_tracker(void)
inline nest_zone_tracker *nz_tracker(void)
rmath::radians random_angle(void)

Calculate a random angle in [0, pi] for the purposes of direction change.

RCPPSW_HFSM_ENTRY_DECLARE_ND(util_hfsm, entry_wait_for_signal)

Simple state for entry into the “wait for external signal” state.

In order:

  • Reset/stop locomotion.

  • Change LED color for visualization purposes.

inline rmath::rng *rng(void)
inline const rmath::rng *rng(void) const
inline csubsystem::base_saa_subsystem *saa(void)
inline const csubsystem::base_saa_subsystem *saa(void) const