DUNE: Uniform Navigational Environment  2.4.2
DUNE::Maneuvers::Maneuver Class Reference

Detailed Description

Base abstract class for maneuver tasks.

Public Member Functions

 Maneuver (const std::string &name, Tasks::Context &ctx)
 
virtual ~Maneuver ()
 
void onResourceInitialization (void)
 
virtual void onManeuverActivation (void)
 
virtual void onManeuverDeactivation (void)
 
void onActivation (void)
 
void onDeactivation (void)
 
template<typename T , typename M >
void startManeuver (const M *maneuver)
 
template<typename T , typename M >
void bindToManeuver (void)
 
template<typename M , typename T >
void consumeIfActive (const M *msg)
 
template<typename M , typename T >
void bind (T *task_obj, bool always=false)
 
void consume (const IMC::StopManeuver *sm)
 
void setControl (uint32_t mask)
 
virtual void onStateReport (void)
 
void updateLoops (const IMC::ControlLoops *cl)
 
void signalError (const std::string &msg)
 
void signalInvalidZ (void)
 
void signalNoAltitude (void)
 
void signalCompletion (const std::string &msg="done")
 
void signalProgress (uint16_t time_left, const std::string &msg)
 
void signalProgress (const std::string &msg)
 
void signalProgress (uint16_t time_left)
 
void signalProgress (void)
 
void onMain (void)
 
- Public Member Functions inherited from DUNE::Tasks::Task
 Task (const std::string &name, Context &context)
 
virtual ~Task (void)
 
const char * getName (void) const
 
const char * getSystemName (void) const
 
unsigned int getSystemId (void) const
 
unsigned int getEntityId (void) const
 
uint16_t getActivationTime (void) const
 
uint16_t getDeactivationTime (void) const
 
unsigned int resolveSystemName (const std::string &name) const
 
const char * resolveSystemId (unsigned int id) const
 
void loadConfig (void)
 
void setPriority (unsigned int value)
 
unsigned int getPriority (void) const
 
void inf (const char *format,...) DUNE_PRINTF_FORMAT(2
 
void void war (const char *format,...) DUNE_PRINTF_FORMAT(2
 
void void void err (const char *format,...) DUNE_PRINTF_FORMAT(2
 
void void void void cri (const char *format,...) DUNE_PRINTF_FORMAT(2
 
void void void void void debug (const char *format,...) DUNE_PRINTF_FORMAT(2
 
void void void void void void trace (const char *format,...) DUNE_PRINTF_FORMAT(2
 
void void void void void void void spew (const char *format,...) DUNE_PRINTF_FORMAT(2
 
void void void void void void
void void 
dispatch (IMC::Message *msg, unsigned int flags=0)
 
void dispatch (IMC::Message &msg, unsigned int flags=0)
 
void dispatchReply (const IMC::Message &original, IMC::Message &msg, unsigned int flags=0)
 
void receive (const IMC::Message *msg)
 
void reserveEntities (void)
 
void resolveEntities (void)
 
void acquireResources (void)
 
void releaseResources (void)
 
void initializeResources (void)
 
void updateParameters (bool act_deact=true)
 
void writeParamsXML (std::ostream &os) const
 
- Public Member Functions inherited from DUNE::Tasks::AbstractTask
 AbstractTask (void)
 
virtual ~AbstractTask (void)
 
- Public Member Functions inherited from DUNE::Concurrency::Thread
 Thread (void)
 
virtual ~Thread (void)
 
int getProcessorUsage (void)
 
- Public Member Functions inherited from DUNE::Concurrency::Runnable
 Runnable (void)
 
virtual ~Runnable (void)
 
void start (void)
 
void stop (void)
 
void join (void)
 
void stopAndJoin (void)
 
void setPriority (Scheduler::Policy policy, unsigned priority)
 
State getState (void)
 
bool isCreated (void)
 
bool isStopping (void)
 
bool isRunning (void)
 
bool isStarting (void)
 
bool isDead (void)
 

Additional Inherited Members

- Public Types inherited from DUNE::Concurrency::Runnable
enum  State {
  StateStarting, StateRunning, StateStopping, StateDead,
  StateUnknown
}
 
- Protected Member Functions inherited from DUNE::Tasks::Task
const char * getEntityLabel (void) const
 
void setEntityLabel (const std::string &label)
 
void setEntityState (IMC::EntityState::StateEnum state, Status::Code code)
 
void setEntityState (IMC::EntityState::StateEnum state, const std::string &description)
 
IMC::EntityState::StateEnum getEntityState (void) const
 
unsigned int reserveEntity (const std::string &label)
 
unsigned int resolveEntity (const std::string &label) const
 
std::string resolveEntity (unsigned int id) const
 
bool stopping (void)
 
bool isActive (void) const
 
void waitForMessages (double timeout)
 
void consumeMessages (void)
 
template<typename T >
Parameterparam (const std::string &name, T &var)
 
template<typename Y , typename T >
Parameterparam (const std::string &name, T &var)
 
template<typename T >
bool paramChanged (T &var)
 
void paramActive (Parameter::Scope def_scope, Parameter::Visibility def_visibility, bool def_value=false)
 
void setParamSectionEditor (const std::string &name)
 
template<typename M , typename T >
void bind (T *task_obj, void(T::*consumer)(const M *)=&T::consume)
 
template<typename T >
void bind (T *task_obj, const std::vector< uint32_t > &list)
 
template<typename T >
void bind (T *task_obj, const std::vector< std::string > &list)
 
void requestActivation (void)
 
void requestDeactivation (void)
 
void activate (void)
 
void activationFailed (const std::string &reason)
 
void deactivate (void)
 
void deactivationFailed (const std::string &reason)
 
virtual void onEntityReservation (void)
 
virtual void onEntityResolution (void)
 
virtual void onReportEntityState (void)
 
virtual void onResourceAcquisition (void)
 
virtual void onResourceRelease (void)
 
virtual void onUpdateParameters (void)
 
virtual void onRequestActivation (void)
 
virtual void onRequestDeactivation (void)
 
- Protected Member Functions inherited from DUNE::Concurrency::Thread
void startImpl (void)
 
void stopImpl (void)
 
void joinImpl (void)
 
void setPriorityImpl (Scheduler::Policy policy, unsigned priority)
 
- Protected Attributes inherited from DUNE::Tasks::Task
Contextm_ctx
 

Constructor & Destructor Documentation

DUNE::Maneuvers::Maneuver::Maneuver ( const std::string &  name,
Tasks::Context ctx 
)

Constructor.

DUNE::Maneuvers::Maneuver::~Maneuver ( void  )
virtual

Destructor.

Member Function Documentation

template<typename M , typename T >
void DUNE::Maneuvers::Maneuver::bind ( T *  task_obj,
bool  always = false 
)
inline
template<typename T , typename M >
void DUNE::Maneuvers::Maneuver::bindToManeuver ( void  )
inline
void DUNE::Maneuvers::Maneuver::consume ( const IMC::StopManeuver sm)

Consumer for StopManeuver message.

Parameters
smmessage to consume.

Referenced by consumeIfActive(), and startManeuver().

template<typename M , typename T >
void DUNE::Maneuvers::Maneuver::consumeIfActive ( const M *  msg)
inline
void DUNE::Maneuvers::Maneuver::onActivation ( void  )
virtual

On task activation Should be used only by parent class Maneuver.

Reimplemented from DUNE::Tasks::Task.

References DUNE::Status::CODE_ACTIVE, and DUNE::IMC::EntityState::ESTA_NORMAL.

void DUNE::Maneuvers::Maneuver::onDeactivation ( void  )
virtual

On task deactivation Should be used only by parent class Maneuver.

Reimplemented from DUNE::Tasks::Task.

References DUNE::Status::CODE_IDLE, and DUNE::IMC::EntityState::ESTA_NORMAL.

void DUNE::Maneuvers::Maneuver::onMain ( void  )
virtual

Implements DUNE::Tasks::Task.

virtual void DUNE::Maneuvers::Maneuver::onManeuverActivation ( void  )
inlinevirtual

On maneuver activation.

virtual void DUNE::Maneuvers::Maneuver::onManeuverDeactivation ( void  )
inlinevirtual

On maneuver deactivation.

void DUNE::Maneuvers::Maneuver::onResourceInitialization ( void  )
inlinevirtual
virtual void DUNE::Maneuvers::Maneuver::onStateReport ( void  )
inlinevirtual

State report handler.

It should be overriden by maneuvers where it convenient to do so in time-triggered manner rather than in response to a particular message.

void DUNE::Maneuvers::Maneuver::setControl ( uint32_t  mask)

Set or reconfigure control loops used by maneuver task.

Parameters
maskmask identifying controllers that should be made active.

References DUNE::IMC::CL_ALL, DUNE::IMC::ControlLoops::CL_DISABLE, DUNE::IMC::ControlLoops::CL_ENABLE, DUNE::IMC::ControlLoops::enable, DUNE::IMC::ControlLoops::mask, and DUNE::IMC::ControlLoops::scope_ref.

void DUNE::Maneuvers::Maneuver::signalCompletion ( const std::string &  msg = "done")

Signal an error.

This method should be used by subclasses to signal maneuver completion.

Parameters
msgcompletion message

References DUNE::IMC::ManeuverControlState::MCS_DONE.

void DUNE::Maneuvers::Maneuver::signalError ( const std::string &  msg)

Signal an error.

This method should be used by subclasses to signal an error condition.

Parameters
msgerror message

References DUNE::IMC::ManeuverControlState::MCS_ERROR.

void DUNE::Maneuvers::Maneuver::signalInvalidZ ( void  )

Signal invalid Z reference This method should be used by subclasses to signal an error condition.

void DUNE::Maneuvers::Maneuver::signalNoAltitude ( void  )

Signal no altitude error.

This method should be used by subclasses to signal an error condition.

void DUNE::Maneuvers::Maneuver::signalProgress ( uint16_t  time_left,
const std::string &  msg 
)

Signal maneuver progress.

Parameters
time_leftestimated time for completion.
msghuman-readable information.

References DUNE::IMC::ManeuverControlState::MCS_EXECUTING.

Referenced by signalProgress(), and startManeuver().

void DUNE::Maneuvers::Maneuver::signalProgress ( const std::string &  msg)
inline

Signal maneuver progress.

Parameters
msghuman-readable information.

References signalProgress().

void DUNE::Maneuvers::Maneuver::signalProgress ( uint16_t  time_left)
inline

Signal maneuver progress.

Parameters
time_leftestimated time for completion.

References signalProgress().

void DUNE::Maneuvers::Maneuver::signalProgress ( void  )
inline

Signal maneuver progress.

References signalProgress().

template<typename T , typename M >
void DUNE::Maneuvers::Maneuver::startManeuver ( const M *  maneuver)
inline

Method fired on maneuver startup.

It performs some initialization, then delegates handling on the task's consume method for the message.

Parameters
maneuvermaneuver object

References consume(), DUNE::Tasks::Task::debug(), DUNE::Tasks::Task::isActive(), DUNE::Tasks::Task::requestActivation(), signalProgress(), and DUNE::Time::Delay::wait().

void DUNE::Maneuvers::Maneuver::updateLoops ( const IMC::ControlLoops cl)

Update active control loops.

Parameters
clcontrol loops message

References DUNE::IMC::ControlLoops::CL_ENABLE, DUNE::IMC::ControlLoops::enable, and DUNE::IMC::ControlLoops::mask.

Collaboration diagram for DUNE::Maneuvers::Maneuver:
Collaboration graph