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

Detailed Description

Plan Specification parser.

Classes

struct  Node
 

Public Types

typedef std::map< std::string,
Node
PlanMap
 
typedef std::vector
< IMC::PlanManeuver * >
::const_iterator 
const_iterator
 

Public Member Functions

 Plan (const IMC::PlanSpecification *spec, bool compute_progress, float speed_rpm_factor, float speed_act_factor)
 
 Plan (const IMC::PlanSpecification *spec, bool compute_progress)
 
 ~Plan (void)
 
void clear (void)
 
bool parse (std::string &desc, const std::set< uint16_t > *supported_maneuvers, bool plan_startup, const std::map< std::string, IMC::EntityInfo > &cinfo, Tasks::Task *task, const IMC::EstimatedState *state=NULL)
 
void planStarted (void)
 
void planStopped (void)
 
void calibrationStarted (const Calibration *calib)
 
void maneuverStarted (const std::string &id)
 
void maneuverDone (void)
 
uint16_t getCalibrationTime (void) const
 
bool isDone (void) const
 
IMC::PlanManeuver * loadStartManeuver (void)
 
IMC::PlanManeuver * loadNextManeuver (void)
 
std::string getCurrentId (void) const
 
float getExecutionDuration (void) const
 
float getTotalDuration (void) const
 
float getExecutionPercentage (void) const
 
float updateProgress (const IMC::ManeuverControlState *mcs, Calibration *calib)
 
bool onEntityActivationState (const std::string &id, const IMC::EntityActivationState *msg)
 
bool waitingForDevice (void)
 
float getPlanEta (void) const
 
size_t size (void) const
 
const_iterator begin (void) const
 
const_iterator end (void) const
 
float calibTimeLeft (void) const
 

Member Typedef Documentation

typedef std::vector<IMC::PlanManeuver*>::const_iterator Plan::Engine::Plan::const_iterator

Iterator.

typedef std::map<std::string, Node> Plan::Engine::Plan::PlanMap

Mapping between maneuver IDs and graph nodes.

Constructor & Destructor Documentation

Plan::Engine::Plan::Plan ( const IMC::PlanSpecification *  spec,
bool  compute_progress,
float  speed_rpm_factor,
float  speed_act_factor 
)
inline

Default constructor.

Parameters
[in]specpointer to PlanSpecification message
[in]compute_progresstrue if progress should be computed
[in]speed_rpm_factorfactor to convert from RPMs to m/s
[in]speed_act_factorfactor to convert from actuation to m/s
Plan::Engine::Plan::Plan ( const IMC::PlanSpecification *  spec,
bool  compute_progress 
)
inline

No speed conversion constructor.

Parameters
[in]specpointer to PlanSpecification message
[in]compute_progresstrue if progress should be computed

References Plan::Engine::Plan.

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

Member Function Documentation

const_iterator Plan::Engine::Plan::begin ( void  ) const
inline

Return an iterator referring to the first element in the list container.

Returns
iterator.
void Plan::Engine::Plan::calibrationStarted ( const Calibration calib)
inline

Signal that calibration has started.

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

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

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

Returns calibration time left according to scheduler.

Returns
calibration time left or -1 if no scheduler is active

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

void Plan::Engine::Plan::clear ( void  )
inline

Reset data.

const_iterator Plan::Engine::Plan::end ( void  ) const
inline

Returns an iterator referring to the past-the-end element in the list container.

Returns
iterator.
uint16_t Plan::Engine::Plan::getCalibrationTime ( void  ) const
inline

Get necessary calibration time.

Returns
necessary calibration time

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

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

Get current maneuver id.

Returns
current id string

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

float Plan::Engine::Plan::getExecutionDuration ( void  ) const
inline

Get duration of the execution phase of the plan (total of maneuver accumulated duration)

Returns
duration of the execution phase of the plan
float Plan::Engine::Plan::getExecutionPercentage ( void  ) const
inline

Get execution percentage.

Returns
percentage of the plan represented by the execution
float Plan::Engine::Plan::getPlanEta ( void  ) const
inline

Get plan estimated time of arrival.

Returns
ETA

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

float Plan::Engine::Plan::getTotalDuration ( void  ) const
inline

Get total duration of the plan.

Returns
total duration of the plan
bool Plan::Engine::Plan::isDone ( void  ) const
inline

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  )
inline

Get next maneuver message.

Returns
NULL if maneuver id is invalid

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

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

Get start maneuver message.

Returns
NULL if start maneuver id is invalid

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

void Plan::Engine::Plan::maneuverDone ( void  )
inline

Signal that current maneuver is done.

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

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

Signal that a maneuver has started.

Parameters
[in]idname of the started maneuver

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

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

Pass EntityActivationState to scheduler.

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

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

bool Plan::Engine::Plan::parse ( std::string &  desc,
const std::set< uint16_t > *  supported_maneuvers,
bool  plan_startup,
const std::map< std::string, IMC::EntityInfo > &  cinfo,
Tasks::Task *  task,
const IMC::EstimatedState *  state = NULL 
)
inline

Parse a given plan.

Parameters
[out]descdescription of the failure if any
[in]supported_maneuverslist of supported maneuvers
[in]plan_startuptrue if the plan is starting up
[in]cinfomap of components info
[in]taskpointer to task
[in]statepointer to EstimatedState message
Returns
true if was able to parse the plan

References Plan::Engine::ActionSchedule, Plan::Engine::Plan::Node::pman, Plan::Engine::Plan::Node::trans, and DUNE::Math::trimValue().

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

void Plan::Engine::Plan::planStarted ( void  )
inline

Signal that the plan has started.

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

void Plan::Engine::Plan::planStopped ( void  )
inline

Signal that the plan has stopped.

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

size_t Plan::Engine::Plan::size ( void  ) const
inline

Retrieve the number of elements in sequential list.

Returns
number of elements in the list.
float Plan::Engine::Plan::updateProgress ( const IMC::ManeuverControlState *  mcs,
Calibration calib 
)
inline

Get current plan progress.

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

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

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

Check if scheduler is waiting for a device.

Returns
true if waiting for device

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

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