Program Listing for File state_tracker.hpp
↰ Return to documentation for file (cosm/fsm/state_tracker.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include "rcppsw/math/vector3.hpp"
#include "rcppsw/types/timestep.hpp"
#include "cosm/cosm.hpp"
#include "cosm/subsystem/subsystem_fwd.hpp"
/*******************************************************************************
* Namespaces/Decls
******************************************************************************/
namespace cosm::fsm {
/*******************************************************************************
* Class Definitions
******************************************************************************/
class state_tracker {
public:
explicit state_tracker(const csubsystem::sensing_subsystem* const sensing)
: mc_sensing(sensing) {}
virtual ~state_tracker(void) = default;
state_tracker(const state_tracker&) = delete;
state_tracker& operator=(const state_tracker&) = delete;
/* state metrics */
bool in_state(void) const RCPPSW_PURE;
bool entered_state(void) const RCPPSW_PURE;
bool exited_state(void) const RCPPSW_PURE;
rtypes::timestep state_duration(void) const;
rtypes::timestep state_entry_time(void) const;
rmath::vector3z state_loc3D(void) const RCPPSW_PURE;
void state_enter(void);
void state_exit(void);
void state_reset(void);
private:
/* clang-format off */
const subsystem::sensing_subsystem* const mc_sensing;
bool m_entered_state{false};
bool m_exited_state{false};
bool m_in_state{false};
rtypes::timestep m_state_start{0};
/* clang-format on */
};
} /* namespace cosm::fsm */