DUNE: Uniform Navigational Environment  2019.02.1
Plan::Engine::Plan Class Reference

Detailed Description

Plan Specification parser.

Classes

struct  ParseError
 

Public Member Functions

 Plan (const IMC::PlanSpecification *spec, bool compute_progress, bool fpredict, float max_depth, Tasks::Task *task, uint16_t min_cal_time, Parsers::Config *cfg)
 
 ~Plan (void)
 
void clear (void)
 
void parse (const std::set< uint16_t > *supported_maneuvers, const std::map< std::string, IMC::EntityInfo > &cinfo, IMC::PlanStatistics &ps, bool imu_enabled=false, const IMC::EstimatedState *state=NULL)
 
void planStarted (void)
 
void planStopped (void)
 
void calibrationStarted (void)
 
void maneuverStarted (const std::string &id)
 
void maneuverDone (void)
 
uint16_t getEstimatedCalibrationTime (void) const
 
bool isDone (void) const
 
IMC::PlanManeuver * loadStartManeuver (void)
 
IMC::PlanManeuver * loadNextManeuver (void)
 
std::string getCurrentId (void) const
 
const std::string getCalibrationInfo (void) const
 
bool isCalibrationDone (void) const
 
bool hasCalibrationFailed (void) const
 
float updateProgress (const IMC::ManeuverControlState *mcs)
 
void updateCalibration (const IMC::VehicleState *vs)
 
bool onEntityActivationState (const std::string &id, const IMC::EntityActivationState *msg)
 
void onFuelLevel (const IMC::FuelLevel *msg)
 
float getETA (void) const
 

Constructor & Destructor Documentation

Plan::Engine::Plan::Plan ( const IMC::PlanSpecification *  spec,
bool  compute_progress,
bool  fpredict,
float  max_depth,
Tasks::Task *  task,
uint16_t  min_cal_time,
Parsers::Config *  cfg 
)

Default constructor.

Parameters
[in]specpointer to PlanSpecification message
[in]compute_progresstrue if progress should be computed
[in]fpredicttrue if fuel prediction should be computed
[in]max_depthmaximum admissible depth
[in]taskpointer to task
[in]min_cal_timeminimum calibration time in s.
[in]cfgpointer to config object

References Plan::Engine::Calibration.

Plan::Engine::Plan::~Plan ( void  )

Destructor.

Member Function Documentation

void Plan::Engine::Plan::calibrationStarted ( void  )

Signal that calibration has started.

References Plan::Engine::Calibration::setTime().

void Plan::Engine::Plan::clear ( void  )
const std::string Plan::Engine::Plan::getCalibrationInfo ( void  ) const
inline

Get calibration info string.

Returns
calibration info string
std::string Plan::Engine::Plan::getCurrentId ( void  ) const
inline

Get current maneuver id.

Returns
current id string

Referenced by getETA().

uint16_t Plan::Engine::Plan::getEstimatedCalibrationTime ( void  ) const

Get necessary calibration time.

Returns
necessary calibration time
bool Plan::Engine::Plan::hasCalibrationFailed ( void  ) const
inline

Has calibration failed.

Returns
true if so, false otherwise
bool Plan::Engine::Plan::isCalibrationDone ( void  ) const
inline

Is calibration done.

Returns
true if so, false otherwise
bool Plan::Engine::Plan::isDone ( void  ) const

Check if plan has been completed.

Returns
true if plan is done
IMC::PlanManeuver * Plan::Engine::Plan::loadNextManeuver ( void  )

Get next maneuver message.

Returns
NULL if maneuver id is invalid
IMC::PlanManeuver * Plan::Engine::Plan::loadStartManeuver ( void  )

Get start maneuver message.

Returns
NULL if start maneuver id is invalid
void Plan::Engine::Plan::maneuverDone ( void  )
void Plan::Engine::Plan::maneuverStarted ( const std::string &  id)

Signal that a maneuver has started.

Parameters
[in]idname of the started maneuver

References Plan::Engine::ActionSchedule::maneuverStarted(), and Plan::Engine::RunTimeStatistics::maneuverStarted().

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

Pass EntityActivationState to scheduler.

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

References Plan::Engine::ActionSchedule::onEntityActivationState().

void Plan::Engine::Plan::onFuelLevel ( const IMC::FuelLevel *  msg)

Pass FuelLevel to FuelPrediction.

Parameters
[in]msgFuelLevel message

References Plan::Engine::FuelPrediction::onFuelLevel().

void Plan::Engine::Plan::parse ( const std::set< uint16_t > *  supported_maneuvers,
const std::map< std::string, IMC::EntityInfo > &  cinfo,
IMC::PlanStatistics &  ps,
bool  imu_enabled = false,
const IMC::EstimatedState *  state = NULL 
)

Parse a given plan.

Parameters
[in]supported_maneuverslist of supported maneuvers
[in]cinfomap of components info
[out]psreference to PlanStatistics message
[in]imu_enabledtrue if imu enabled, false otherwise
[in]statepointer to EstimatedState message

References clear().

void Plan::Engine::Plan::planStarted ( void  )
void Plan::Engine::Plan::planStopped ( void  )
float Plan::Engine::Plan::updateProgress ( const IMC::ManeuverControlState *  mcs)

Get current plan progress.

Parameters
[in]mcspointer to maneuver control state message
Returns
progress in percent (-1.0 if unable to compute)

References Plan::Engine::ActionSchedule::flushTimed(), getETA(), and Plan::Engine::ActionSchedule::updateSchedule().

Collaboration diagram for Plan::Engine::Plan:
Collaboration graph