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

Detailed Description

Scheduler for plan and maneuver actions.

Public Member Functions

 ActionSchedule (Tasks::Task *task, const IMC::PlanSpecification *spec, const std::vector< IMC::PlanManeuver * > &nodes, const Timeline &tline, 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)
 
void fillComponentActiveTime (const std::vector< IMC::PlanManeuver * > &nodes, const Timeline &timeline, ComponentActiveTime &cat)
 

Constructor & Destructor Documentation

Plan::Engine::ActionSchedule::ActionSchedule ( Tasks::Task *  task,
const IMC::PlanSpecification *  spec,
const std::vector< IMC::PlanManeuver * > &  nodes,
const Timeline tline,
const std::map< std::string, IMC::EntityInfo > &  cinfo 
)

Default constructor.

Parameters
[in]taskpointer to task
[in]specpointer to PlanSpecification message
[in]nodesvector of sequential PlanManeuvers that describe the plan
[in]tlineplan timeline with maneuvers' and plan's ETAs
[in]cinfomap of components info

References Plan::Engine::Timeline::getExecutionDuration(), Plan::Engine::Timeline::getManeuverEndETA(), and Plan::Engine::Timeline::getManeuverStartETA().

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 
)

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  )

Compute a shorter time for calibration.

Returns
time left for calibration according to devices to activate
void Plan::Engine::ActionSchedule::fillComponentActiveTime ( const std::vector< IMC::PlanManeuver * > &  nodes,
const Timeline timeline,
ComponentActiveTime cat 
)

Fill the object component active time.

Parameters
[in]nodesvector of sequenced plan maneuvers
[in]timelineplan timeline with all ETAs
[in]catcomponent active time object to fill

References Plan::Engine::ComponentActiveTime::addActiveTime(), Plan::Engine::ComponentActiveTime::clear(), Plan::Engine::Timeline::getManeuverEndETA(), Plan::Engine::Timeline::getManeuverStartETA(), Plan::Engine::Timeline::getPlanETA(), and Plan::Engine::ComponentActiveTime::subtractActiveTime().

void Plan::Engine::ActionSchedule::flushTimed ( void  )

Flush all remaining timed actions in the schedule.

Referenced by Plan::Engine::Plan::updateProgress().

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)

Maneuver has stopped.

Parameters
[in]idname of the done maneuver

Referenced by Plan::Engine::Plan::maneuverDone().

void Plan::Engine::ActionSchedule::maneuverStarted ( const std::string &  id)

Maneuver has started.

Parameters
[in]idname of the started maneuver

Referenced by Plan::Engine::Plan::maneuverStarted().

bool Plan::Engine::ActionSchedule::onEntityActivationState ( const std::string &  id,
const IMC::EntityActivationState *  msg 
)

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

Referenced by Plan::Engine::Plan::onEntityActivationState().

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

The plan has started.

Parameters
[out]affectedvector of entities that will be (de)activated during the plan

Referenced by Plan::Engine::Plan::planStarted().

void Plan::Engine::ActionSchedule::planStopped ( const std::vector< std::string > &  affected)

The plan has stopped/ended.

Parameters
[in]affectedvector of entities that were (de)activated during last executed plan

Referenced by Plan::Engine::Plan::planStopped().

void Plan::Engine::ActionSchedule::updateSchedule ( float  time_left)

Update timed actions in schedule.

Parameters
[in]time_leftestimated time left to finish the plan

Referenced by Plan::Engine::Plan::updateProgress().

bool Plan::Engine::ActionSchedule::waitingForDevice ( void  )

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