Class acquire_goal_fsm
Defined in File acquire_goal_fsm.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Types
public cspatial::fsm::util_hfsm
public rer::client< acquire_goal_fsm >
public cosm::ta::taskable
(Class taskable)public cspatial::metrics::goal_acq_metrics
Class Documentation
-
class acquire_goal_fsm : public cspatial::fsm::util_hfsm, public rer::client<acquire_goal_fsm>, public cosm::ta::taskable, public cspatial::metrics::goal_acq_metrics
The base FSM for an acquiring a goal in the arena.
Each robot executing this FSM will acquire an instance of its goal (either a known instance or via random exploration). Once the instance has been acquired, it signals that it has completed its task.
Public Types
-
using acquisition_goal_ftype = std::function<goal_acq_metrics::goal_type(void)>
Function type which returns the FSM’s current goal via goal_acq_metrics::goal_type.
-
using candidate_type = std::tuple<rmath::vector2d, double, rtypes::type_uuid>
Tuple representing a goal to be acquired: A location, the utility associated with that location, and an integer identifier for the location (e.g. UUID of the object), which can be rtypes::constants::kNoUUID if unused.
-
using goal_select_ftype = std::function<boost::optional<candidate_type>(void)>
Function type returning a candidate_type if any is found, and an empty boost::optional<> otherwise.
-
using goal_valid_ftype = std::function<bool(const rmath::vector2d&, const rtypes::type_uuid&)>
Function type which returns if the current acquisition goal is still valid for acquisition, given its location and the ID of the goal. This is necessary as the state of the arena may change between when a goal is selected for acqusition and when a robot arrives, and we don’t want to waste effort attempting to acquire a goal that no longer exists (for example).
Public Functions
-
acquire_goal_fsm(const acquire_goal_fsm &fsm) = delete
-
acquire_goal_fsm(const csfsm::fsm_params *params, std::unique_ptr<cssexplore::base_explore> explore_behavior, rmath::rng *rng, const struct hook_list &hooks)
- Parameters:
saa – Handle to sensing and actuation subsystem.
explore_behavior – The exploration behavior to use; can be NULL if goal acquisition should always be performed via vectoring.
rng – Random number generator for use internally.
hooks – List of function callbacks that derived classes should pass in ordr to make use of the general purpose machinery in this class.
-
~acquire_goal_fsm(void) override = default
-
metrics::goal_acq_metrics::goal_type acquisition_goal(void) const final override
-
boost::optional<rmath::vector3z> acquisition_loc3D(void) const final override
-
bool entered_interference(void) const final override
-
inline rtypes::type_uuid entity_acquired_id(void) const final override
-
bool exited_interference(void) const final override
-
bool exp_interference(void) const final override
-
boost::optional<rmath::vector3z> explore_loc3D(void) const final override
-
bool goal_acquired(void) const final override
-
void init(void) final override
-
boost::optional<rtypes::timestep> interference_duration(void) const final override
-
boost::optional<rmath::vector3z> interference_loc3D(void) const final override
-
exp_status is_exploring_for_goal(void) const final override
-
bool is_vectoring_to_goal(void) const final override
-
acquire_goal_fsm &operator=(const acquire_goal_fsm &fsm) = delete
-
virtual void task_execute(void) final override
Execute the task.
-
inline virtual bool task_finished(void) const final override
Determine if the task has finished yet.
- Returns:
TRUE
if the task has finished, andFALSE
otherwise.
-
inline virtual void task_reset(void) final override
Reset the task so that it is ready for execution again. Does nothing by default.
-
inline virtual bool task_running(void) const final override
Determine if the task has is still running yet.
- Returns:
TRUE
if the task is still running, andFALSE
otherwise.
-
inline virtual void task_start(ta::taskable_argument*) override
Start the task with the specified argument. The argument is consumed by the called function.
-
boost::optional<rmath::vector3z> vector_loc3D(void) const final override
Protected Types
-
enum states
Defines the state map for the FSM.
Note that the order of the states in the map MUST match the order of the states in, or things will not work correctly.
Values:
-
enumerator ekST_START
Transient starting state.
-
enumerator ekST_ACQUIRE_GOAL
Superstate for acquiring a goal via vectoring or exploration.
-
enumerator ekST_FINISHED
Goal has been acquired!
-
enumerator ekST_MAX_STATES
-
enumerator ekST_START
-
struct hook_list
Public Members
-
acquisition_goal_ftype acquisition_goal = {nullptr}
Callback used to tell the FSM what is the ultimate goal of the acquisition. However, the return of acquisition_goal() may not always be the same as the specified goal, depending on what the current FSM state is.
-
std::function<void(void)> begin_acq_cb = {nullptr}
Callback called on the first timestep of goal acquisition, in case state needs to be reset after goal selection.
-
std::function<bool(void)> candidates_exist = {nullptr}
Callback used to determine if any goal candidates are currently available/eligible for acquisition.
-
std::function<bool(void)> explore_term_cb = {nullptr}
Callback for goal detection during exploration. This fsm can’t know when a goal has been reached without losing its generality when exploring, so this callback is provided to it for that purpose. Should return
TRUE
if the goal has been detected/reached and exploration should terminate, andFALSE
otherwise.
-
std::function<bool(bool)> goal_acquired_cb = {nullptr}
Callback used after a goal has been acquired for sanity check/verification of state. Will be passed
TRUE
if the acquired goal was obtained via exploration, rather than vectoring, and false if it was obtained via vectoring. Should returnTRUE
if the goal has REALLY been acquired, andFALSE
otherwise (the goal may have vanished if it was a block/cache, for example).
-
goal_select_ftype goal_select = {nullptr}
Function used to select a goal from the list of candidates. Should return the “best” candidate that should be acquired.
-
goal_valid_ftype goal_valid_cb = {nullptr}
Callback for verifying goal validity during vectoring/exploration. If for any reason the specific goal becomes invalid before the robot has acquired it, then it should return
FALSE
.
-
acquisition_goal_ftype acquisition_goal = {nullptr}
-
using acquisition_goal_ftype = std::function<goal_acq_metrics::goal_type(void)>