Program Listing for File util_hfsm.hpp
↰ Return to documentation for file (cosm/spatial/fsm/util_hfsm.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include <memory>
#include <string>
#include "rcppsw/math/rng.hpp"
#include "rcppsw/math/vector2.hpp"
#include "rcppsw/patterns/fsm/hfsm.hpp"
#include "rcppsw/spatial/euclidean_dist.hpp"
#include "cosm/cosm.hpp"
#include "cosm/spatial/common/interference_tracker.hpp"
#include "cosm/spatial/metrics/interference_metrics.hpp"
#include "cosm/spatial/strategy/base_strategy.hpp"
#include "cosm/spatial/common/nest_zone_tracker.hpp"
#include "cosm/spatial/metrics/nest_zone_metrics.hpp"
#include "cosm/subsystem/subsystem_fwd.hpp"
#include "cosm/spatial/fsm/fsm_params.hpp"
/*******************************************************************************
* Namespaces
******************************************************************************/
namespace cosm::spatial::fsm {
/*******************************************************************************
* Class Definitions
******************************************************************************/
class util_hfsm : public rpfsm::hfsm,
public rer::client<util_hfsm>,
public metrics::interference_metrics,
public metrics::nest_zone_metrics {
public:
util_hfsm(const fsm_params* params,
rmath::rng* rng,
uint8_t max_states);
~util_hfsm(void) override = default;
util_hfsm(const util_hfsm&) = delete;
util_hfsm& operator=(const util_hfsm&) = delete;
void init(void) override;
csubsystem::sensing_subsystem* sensing(void) RCPPSW_PURE;
const csubsystem::sensing_subsystem* sensing(void) const RCPPSW_PURE;
typename csubsystem::actuation_subsystem* actuation(void) RCPPSW_PURE;
typename csubsystem::actuation_subsystem* actuation(void) const RCPPSW_PURE;
const interference_tracker* inta_tracker(void) const { return m_inta_tracker; }
const nest_zone_tracker* nz_tracker(void) const { return m_nz_tracker; }
protected:
rmath::radians random_angle(void);
rmath::rng* rng(void) { return m_rng; }
const rmath::rng* rng(void) const { return m_rng; }
const csubsystem::base_saa_subsystem* saa(void) const { return m_saa; }
csubsystem::base_saa_subsystem* saa(void) { return m_saa; }
interference_tracker* inta_tracker(void) { return m_inta_tracker; }
nest_zone_tracker* nz_tracker(void) { return m_nz_tracker; }
RCPPSW_HFSM_ENTRY_DECLARE_ND(util_hfsm, entry_wait_for_signal);
private:
/* clang-format off */
csubsystem::base_saa_subsystem* const m_saa;
interference_tracker* m_inta_tracker;
nest_zone_tracker* m_nz_tracker;
rmath::rng* m_rng;
/* clang-format on */
public:
/* interference metrics */
RCPPSW_WRAP_DECLDEF_OVERRIDE(exp_interference, *m_inta_tracker, const)
RCPPSW_WRAP_DECLDEF_OVERRIDE(entered_interference, *m_inta_tracker, const)
RCPPSW_WRAP_DECLDEF_OVERRIDE(exited_interference, *m_inta_tracker, const)
RCPPSW_WRAP_DECLDEF_OVERRIDE(interference_duration, *m_inta_tracker, const)
RCPPSW_WRAP_DECLDEF_OVERRIDE(interference_loc3D, *m_inta_tracker, const)
/* nest_zone metrics */
RCPPSW_WRAP_DECLDEF_OVERRIDE(in_nest, *m_nz_tracker, const);
RCPPSW_WRAP_DECLDEF_OVERRIDE(entered_nest, *m_nz_tracker, const);
RCPPSW_WRAP_DECLDEF_OVERRIDE(exited_nest, *m_nz_tracker, const);
RCPPSW_WRAP_DECLDEF_OVERRIDE(nest_duration, *m_nz_tracker, const);
RCPPSW_WRAP_DECLDEF_OVERRIDE(nest_entry_time, *m_nz_tracker, const);
};
} /* namespace cosm::spatial::fsm */