DUNE: Uniform Navigational Environment  2016.05.0
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, 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,
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]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().

Referenced by Plan::Engine::Task::vehicleRequest().

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

Get calibration info string.

Returns
calibration info string

Referenced by Plan::Engine::Task::consume().

std::string Plan::Engine::Plan::getCurrentId ( void  ) const
inline

Get current maneuver id.

Returns
current id string

Referenced by Plan::Engine::Task::startManeuver().

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

Get necessary calibration time.

Returns
necessary calibration time

Referenced by Plan::Engine::Task::vehicleRequest().

float Plan::Engine::Plan::getETA ( void  ) const

Get current estimated time of arrival.

Returns
ETA

Referenced by Plan::Engine::Task::reportProgress(), and updateProgress().

bool Plan::Engine::Plan::hasCalibrationFailed ( void  ) const
inline

Has calibration failed.

Returns
true if so, false otherwise

Referenced by Plan::Engine::Task::consume().

bool Plan::Engine::Plan::isCalibrationDone ( void  ) const
inline

Is calibration done.

Returns
true if so, false otherwise

Referenced by Plan::Engine::Task::consume().

bool Plan::Engine::Plan::isDone ( void  ) const

Check if plan has been completed.

Returns
true if plan is done

Referenced by Plan::Engine::Task::onVehicleManeuver().

IMC::PlanManeuver * Plan::Engine::Plan::loadNextManeuver ( void  )

Get next maneuver message.

Returns
NULL if maneuver id is invalid

Referenced by Plan::Engine::Task::onVehicleManeuver().

IMC::PlanManeuver * Plan::Engine::Plan::loadStartManeuver ( void  )

Get start maneuver message.

Returns
NULL if start maneuver id is invalid

Referenced by Plan::Engine::Task::consume(), Plan::Engine::Task::onVehicleService(), and Plan::Engine::Task::startPlan().

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().

Referenced by Plan::Engine::Task::startManeuver().

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().

Referenced by Plan::Engine::Task::consume().

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

Pass FuelLevel to FuelPrediction.

Parameters
[in]msgFuelLevel message

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

Referenced by Plan::Engine::Task::consume().

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().

Referenced by Plan::Engine::Task::parsePlan().

void Plan::Engine::Plan::planStarted ( 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().

Referenced by Plan::Engine::Task::reportProgress().

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