DUNE: Uniform Navigational Environment  2.5.0
Plan::Engine::ActionSchedule Class Reference

Detailed Description

Scheduler for plan and maneuver actions.

Classes

struct  EventActions
 
struct  TimedAction
 

Public Types

enum  ActionType { TYPE_DEACT, TYPE_ACT }
 
typedef std::stack< TimedActionTimedStack
 
typedef std::map< std::string,
EventActions
EventMap
 
typedef std::map< std::string,
uint8_t > 
EASMap
 
typedef std::pair< std::string,
uint8_t > 
EASPair
 

Public Member Functions

 ActionSchedule (Tasks::Task *task, const IMC::PlanSpecification *spec, const std::vector< IMC::PlanManeuver * > &nodes, const Duration::ManeuverDuration &durations, const Duration::ManeuverDuration::const_iterator last_dur, const std::map< std::string, IMC::EntityInfo > &cinfo)
 
 ActionSchedule (Tasks::Task *task, const IMC::PlanSpecification *spec, const std::vector< IMC::PlanManeuver * > &nodes, const std::map< std::string, IMC::EntityInfo > &cinfo)
 
void updateSchedule (float time_left)
 
void flushTimed (void)
 
void planStarted (std::vector< std::string > &affected)
 
void planStopped (const std::vector< std::string > &affected)
 
void maneuverStarted (const std::string &id)
 
void maneuverDone (const std::string &id)
 
float getEarliestSchedule (void) const
 
bool onEntityActivationState (const std::string &id, const IMC::EntityActivationState *msg)
 
bool waitingForDevice (void)
 
float calibTimeLeft (void)
 

Member Typedef Documentation

typedef std::map<std::string, uint8_t> Plan::Engine::ActionSchedule::EASMap

Map of entity names to entity activation states.

typedef std::pair<std::string, uint8_t> Plan::Engine::ActionSchedule::EASPair

Pair for EASMap.

typedef std::map<std::string, EventActions> Plan::Engine::ActionSchedule::EventMap

Map to address event based actions.

Stack of timed actions.

Member Enumeration Documentation

Enumeration for type of timed action.

Enumerator
TYPE_DEACT 

Deactivation.

TYPE_ACT 

Activation.

Constructor & Destructor Documentation

Plan::Engine::ActionSchedule::ActionSchedule ( Tasks::Task *  task,
const IMC::PlanSpecification *  spec,
const std::vector< IMC::PlanManeuver * > &  nodes,
const Duration::ManeuverDuration durations,
const Duration::ManeuverDuration::const_iterator  last_dur,
const std::map< std::string, IMC::EntityInfo > &  cinfo 
)
inline

Default constructor.

Parameters
[in]taskpointer to task
[in]specpointer to PlanSpecification message
[in]nodesvector of sequential PlanManeuvers that describe the plan
[in]durationsinformation regarding each maneuvers duration
[in]last_duriterator to last maneuver with a valid duration
[in]cinfomap of components info
Plan::Engine::ActionSchedule::ActionSchedule ( Tasks::Task *  task,
const IMC::PlanSpecification *  spec,
const std::vector< IMC::PlanManeuver * > &  nodes,
const std::map< std::string, IMC::EntityInfo > &  cinfo 
)
inline

Alternative constructor for when plan is not sequential.

There will be no pre-scheduling using this constructor.

Parameters
[in]taskpointer to task
[in]specpointer to PlanSpecification message
[in]nodesvector of sequential PlanManeuvers that describe the plan
[in]cinfomap of components info

Member Function Documentation

float Plan::Engine::ActionSchedule::calibTimeLeft ( void  )
inline

Compute a shorter time for calibration.

Returns
time left for calibration according to devices to activate
void Plan::Engine::ActionSchedule::flushTimed ( void  )
inline

Flush all remaining timed actions in the schedule.

float Plan::Engine::ActionSchedule::getEarliestSchedule ( void  ) const
inline

Get the time of the earliest scheduled action.

Returns
time of the earliest scheduled action
void Plan::Engine::ActionSchedule::maneuverDone ( const std::string &  id)
inline

Maneuver has stopped.

Parameters
[in]idname of the done maneuver
void Plan::Engine::ActionSchedule::maneuverStarted ( const std::string &  id)
inline

Maneuver has started.

Parameters
[in]idname of the started maneuver
bool Plan::Engine::ActionSchedule::onEntityActivationState ( const std::string &  id,
const IMC::EntityActivationState *  msg 
)
inline

Check if the activation and deactivation requests are being complied.

Parameters
[in]identity label
[in]msgpointer to EntityActivationState message
Returns
false if something failed to be activated, true otherwise

References DUNE::IMC::EntityActivationState::EAS_ACT_DONE, DUNE::IMC::EntityActivationState::EAS_ACT_FAIL, DUNE::IMC::EntityActivationState::EAS_ACTIVE, DUNE::IMC::EntityActivationState::EAS_DEACT_DONE, and DUNE::IMC::EntityActivationState::EAS_INACTIVE.

void Plan::Engine::ActionSchedule::planStarted ( std::vector< std::string > &  affected)
inline

The plan has started.

Parameters
[out]affectedvector of entities that will be (de)activated during the plan
void Plan::Engine::ActionSchedule::planStopped ( const std::vector< std::string > &  affected)
inline

The plan has stopped/ended.

Parameters
[in]affectedvector of entities that were (de)activated during last executed plan
void Plan::Engine::ActionSchedule::updateSchedule ( float  time_left)
inline

Update timed actions in schedule.

Parameters
[in]time_leftestimated time left to finish the plan
bool Plan::Engine::ActionSchedule::waitingForDevice ( void  )
inline

Check if we are still waiting for a device in calibration process.

Returns
true if we are still waiting
Collaboration diagram for Plan::Engine::ActionSchedule:
Collaboration graph