DUNE: Uniform Navigational Environment  2.3.2
DUNE::Tasks::Task Class Referenceabstract

Detailed Description

Public Member Functions

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

Protected Member Functions

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 onResourceInitialization (void)
 
virtual void onUpdateParameters (void)
 
virtual void onRequestActivation (void)
 
virtual void onRequestDeactivation (void)
 
virtual void onActivation (void)
 
virtual void onDeactivation (void)
 
virtual void onMain (void)=0
 
- 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

Contextm_ctx
 

Additional Inherited Members

- Public Types inherited from DUNE::Concurrency::Runnable
enum  State {
  StateStarting, StateRunning, StateStopping, StateDead,
  StateUnknown
}
 
- Static Public Member Functions inherited from DUNE::Concurrency::Thread
static unsigned native (void)
 

Constructor & Destructor Documentation

Task::Task ( const std::string &  name,
Context context 
)

Member Function Documentation

void Task::acquireResources ( void  )

Acquire resources whose configuration depends on dynamic parameters.

References DUNE::Tasks::ParameterTable::end(), DUNE::Tasks::ParameterTable::find(), onResourceAcquisition(), and DUNE::Tasks::Parameter::SCOPE_MANEUVER.

void Task::activationFailed ( const std::string &  reason)
protected

Derived classes should use this function to signal that activation failed.

Parameters
[in]reasonreason for activation failure.

References dispatch(), DUNE::IMC::EntityActivationState::EAS_ACT_FAIL, DUNE::IMC::EntityActivationState::EAS_INACTIVE, DUNE::IMC::EntityActivationState::error, spew(), and DUNE::IMC::EntityActivationState::state.

template<typename M , typename T >
void DUNE::Tasks::Task::bind ( T *  task_obj,
void(T::*)(const M *)  consumer = &T::consume 
)
inlineprotected

Bind a message to a consumer method.

Parameters
task_objconsumer task.
consumerconsumer method.

Referenced by bind(), DUNE::Tasks::SimpleTransport::onMain(), Transports::LoggingDigest::Task::onUpdateParameters(), and Transports::UDP::Task::onUpdateParameters().

template<typename T >
void DUNE::Tasks::Task::bind ( T *  task_obj,
const std::vector< uint32_t > &  list 
)
inlineprotected

Bind multiple messages to a default consumer method.

Parameters
task_objconsumer object.
listlist of message identifiers.

References bind().

template<typename T >
void DUNE::Tasks::Task::bind ( T *  task_obj,
const std::vector< std::string > &  list 
)
inlineprotected

Bind multiple messages to a default consumer method.

Parameters
task_objconsumer task.
listlist of message abbreviations.

References bind(), and DUNE::IMC::Factory::getIdFromAbbrev().

void Task::cri ( const char *  format,
  ... 
)

Send an human-readable critical error message to all configured output channels and files.

Parameters
formatstring format (similar to printf(3)).
...arguments.

References DUNE::IMC::LogBookEntry::LBET_CRITICAL.

void Task::deactivationFailed ( const std::string &  reason)
protected

Derived classes should use this function to signal that deactivation failed.

Parameters
[in]reasonreason for deactivation failure.

References dispatch(), DUNE::IMC::EntityActivationState::EAS_ACTIVE, DUNE::IMC::EntityActivationState::EAS_DEACT_FAIL, DUNE::IMC::EntityActivationState::error, spew(), and DUNE::IMC::EntityActivationState::state.

void Task::debug ( const char *  format,
  ... 
)

Send an human-readable debug message to all configured output channels and files.

The message will only be processed if the configured log level is DEBUG_LEVEL_DEBUG or greater.

Parameters
formatstring format (similar to printf(3)).
...arguments.

References DUNE::Tasks::DEBUG_LEVEL_DEBUG, and DUNE::IMC::LogBookEntry::LBET_DEBUG.

Referenced by Control::AUV::RemoteOperation::Task::actuate(), Plan::DB::Task::answer(), Sensors::OS4000::Task::changeCalibrationState(), Plan::Engine::Task::changeMode(), Plan::Engine::Task::closeDB(), DUNE::Control::PathController::consume(), DUNE::Control::BasicAutopilot::consume(), Control::PTU2::Task::consume(), Control::PTU::Task::consume(), Transports::Iridium::Task::consume(), Transports::IridiumSBD::Task::consume(), Control::AUV::Allocator::Task::consume(), Control::AUV::Speed::Task::consume(), Plan::Engine::Task::consume(), Supervisors::Vehicle::Task::consume(), Control::UAV::Ardupilot::Task::consume(), Transports::IridiumSBD::Task::dequeueTxRequest(), Transports::Replay::Task::displayStats(), Monitors::Entities::Task::enableDefaults(), Control::UAV::Ardupilot::Task::handleArdupilotData(), Control::UAV::Ardupilot::Task::handleCmdAckPacket(), Transports::Iridium::Task::handleDeviceUpdate(), Transports::Iridium::Task::handleIridiumCommand(), Control::UAV::Ardupilot::Task::handleMissionAckPacket(), Control::UAV::Ardupilot::Task::handleNavControllerPacket(), Control::UAV::Ardupilot::Task::handleStatusTextPacket(), Transports::IridiumSBD::Task::invalidateTxRequest(), Control::UAV::Ardupilot::Task::loiterHere(), Supervisors::Vehicle::Task::onDisabledControlLoops(), Supervisors::Vehicle::Task::onEnabledControlLoops(), Transports::IridiumSBD::Task::onResourceAcquisition(), Transports::GSM::Task::onResourceAcquisition(), Vision::DFK51BG02H::Task::onResourceInitialization(), Vision::Lumenera::Task::onResourceInitialization(), Transports::UDP::Task::onUpdateParameters(), Plan::Engine::Task::openDB(), Sensors::Microstrain3DMGX1::Task::parse(), Transports::Iridium::Task::send_device_updates(), Control::UAV::Ardupilot::Task::sendCommandPacket(), Sensors::OS4000::Task::setParameter(), DUNE::Maneuvers::Maneuver::startManeuver(), Supervisors::Vehicle::Task::stopCalibration(), Plan::Engine::Task::stopPlan(), Supervisors::Vehicle::Task::task(), Monitors::FuelLevel::Task::task(), and DUNE::Control::YoYoMotion::update().

void Task::dispatch ( IMC::Message msg,
unsigned int  flags = 0 
)

Dispatch message to the message bus.

Parameters
[in]msgmessage pointer.
[in]flagsbitfield with flags (see DispatchFlags).

References DUNE::Tasks::DF_KEEP_SRC_EID, DUNE::Tasks::DF_KEEP_TIME, DUNE::Tasks::DF_LOOP_BACK, DUNE::IMC::Bus::dispatch(), getEntityId(), DUNE::IMC::Message::getSource(), DUNE::IMC::Message::getSourceEntity(), getSystemId(), DUNE::IMC::AddressResolver::isValid(), m_ctx, DUNE::Tasks::Context::mbus, DUNE::IMC::Message::setSource(), DUNE::IMC::Message::setSourceEntity(), and DUNE::IMC::Message::setTimeStamp().

Referenced by Sensors::MLBLTracker::Task::abort(), Sensors::MLBLTracker::Task::abortNarrowBand(), activate(), activationFailed(), Control::ASV::RemoteOperation::Task::actuate(), Control::ROV::RemoteOperation::Task::actuate(), Control::AUV::RemoteOperation::Task::actuate(), Control::AUV::Allocator::Task::allocate(), Transports::Announce::Task::announce(), Supervisors::Vehicle::Task::answer(), Plan::DB::Task::answer(), Plan::Engine::Task::answer(), Sensors::OS4000::Task::changeCalibrationState(), Plan::Engine::Task::changeLog(), Supervisors::Vehicle::Task::changeMode(), Plan::Engine::Task::changeMode(), Sensors::MLBLTracker::Task::checkTimeouts(), Control::AUV::Allocator::Task::computeProducedTorque(), Sensors::Antaris4::Task::configTimePulse(), DUNE::Control::BasicRemoteOperation::consume(), DUNE::Daemon::consume(), DUNE::Control::PathController::consume(), DUNE::Control::BasicAutopilot::consume(), Control::PTU2::Task::consume(), Monitors::Clock::Task::consume(), Control::PTU::Task::consume(), Sensors::MTi::Task::consume(), Navigation::General::GPSNavigation::Task::consume(), Transports::Iridium::Task::consume(), DUNE::Navigation::BasicNavigation::consume(), Plan::Generator::Task::consume(), Autonomy::TREX::Task::consume(), Monitors::OperationalLimits::Task::consume(), Navigation::General::Alignment::Task::consume(), Sensors::Microstrain3DMGX3::Task::consume(), Supervisors::Vehicle::Task::consume(), Sensors::MLBLTracker::Task::consume(), Control::UAV::Ardupilot::Task::consume(), Sensors::MLBL::Task::consume(), Transports::Cache::Task::copySnapshot(), deactivate(), deactivationFailed(), Sensors::IFOG::Task::decodeFrame(), Control::ROV::Depth::Task::depthControl(), Control::AUV::Attitude::Task::depthControl(), dispatch(), Control::AUV::Allocator::Task::dispatchAllFins(), dispatchReply(), Control::AUV::Speed::Task::dispatchThrust(), Actuators::LED4R::Task::getMonitors(), Autonomy::TextActions::Task::handleAbortCommand(), Control::UAV::Ardupilot::Task::handleBatteryStatusPacket(), Sensors::MLBLTracker::Task::handleCAMPCSNPNT(), Sensors::MLBLTracker::Task::handleCAMPR(), Sensors::MLBLTracker::Task::handleCAMUA(), Sensors::MLBLTracker::Task::handleCAMUC(), Sensors::MLBLTracker::Task::handleCARXD(), DUNE::Tasks::SimpleTransport::handleData(), Transports::Iridium::Task::handleDeviceUpdate(), Control::UAV::Ardupilot::Task::handleHWStatusPacket(), Transports::Iridium::Task::handleIridiumCommand(), Sensors::MLBL::Task::handleMiniPacket(), Control::UAV::Ardupilot::Task::handleNavControllerPacket(), Autonomy::TextActions::Task::handlePlanCommand(), Autonomy::TextActions::Task::handlePlanGeneratorCommand(), Control::UAV::Ardupilot::Task::handlePositionPacket(), Control::UAV::Ardupilot::Task::handleRawGPSPacket(), Transports::IridiumSBD::Task::handleSBD(), Control::UAV::Ardupilot::Task::handleScaledPressurePacket(), Sensors::MLBLTracker::Task::handleSNTTA(), Sensors::MLBL::Task::handleTransponderTravelTimes(), Control::UAV::Ardupilot::Task::handleWindPacket(), Sensors::MLBLTracker::Task::hasTransducer(), Control::ROV::HorizontalPlane::Task::headingControl(), Control::AUV::Attitude::Task::headingControl(), Sensors::Antaris4::Task::interpretVELNED(), DUNE::Navigation::BasicNavigation::isActive(), Transports::Cache::Task::load(), Transports::Cache::Task::loadSnapshot(), Control::Path::VectorField::Task::loiter(), Control::UAV::Ardupilot::Task::loiterHere(), Control::ROV::Depth::Task::onEstimatedState(), Control::AUV::LMI::Task::onEstimatedState(), Control::AUV::Attitude::Task::onEstimatedState(), Sensors::GillWindObserverII::Task::onMain(), Sensors::PPS::Task::onMain(), Sensors::MiniSVS::Task::onMain(), Sensors::DLV3::Task::onMain(), Sensors::XchangeSV::Task::onMain(), Sensors::PTU300::Task::onMain(), Simulators::UAV::Task::onMain(), Sensors::WorkhorseNavigator::Task::onMain(), Autonomy::TREX::Task::onMain(), Transports::Replay::Task::onMain(), Sensors::XR620CTD::Task::onMain(), Sensors::OS4000::Task::onMain(), Plan::Engine::Task::onMain(), Navigation::AUV::SGNavigation::Task::onReportEntityState(), Sensors::MLBL::Task::onReportEntityState(), Vision::Lumenera::Task::onRequestActivation(), Vision::DFK51BG02H::Task::onRequestActivation(), Transports::IridiumSBD::Task::onResourceAcquisition(), Transports::UDP::Task::onResourceAcquisition(), Transports::Iridium::Task::onResourceInitialization(), Sensors::MLBLTracker::Task::onResourceInitialization(), Sensors::Microstrain3DMGX1::Task::parse(), Sensors::MLBLTracker::Task::ping(), Sensors::MLBL::Task::processInput(), Transports::LogBook::Task::provide(), Transports::Discovery::Task::readMessage(), Sensors::MLBLTracker::Task::readSentence(), Monitors::Entities::Task::reportState(), DUNE::Navigation::BasicNavigation::reportToBus(), requestActivation(), requestDeactivation(), Control::ROV::Depth::Task::reset(), Control::AUV::Speed::Task::reset(), Supervisors::Vehicle::Task::reset(), Navigation::AUV::Navigation::Task::runKalmanLBL(), DUNE::Navigation::BasicNavigation::runKalmanLBL(), Transports::Iridium::Task::send_device_updates(), Supervisors::Entities::Task::sendActivation(), Sensors::MLBLTracker::Task::sendCommand(), Vision::PhotoTrigger::Task::sendPulse(), Monitors::Emergency::Task::sendSMS(), Transports::IridiumSBD::Task::sendTxRequestStatus(), Sensors::MLBL::Task::setAndSendState(), setEntityState(), Plan::Engine::Task::setInitialState(), DUNE::Hardware::HayesModem::setRSSI(), Vision::Lumenera::Task::setStrobePower(), Supervisors::Vehicle::Task::startCalibration(), Autonomy::TREX::Task::startExecution(), Supervisors::Vehicle::Task::startManeuver(), Plan::Engine::Task::startPlan(), Transports::Replay::Task::startReplay(), Control::Path::PurePursuit::Task::step(), DUNE::Control::DiscretePID::step(), Control::Path::Aerosonde::Task::step(), Control::Path::VectorField::Task::step(), Autonomy::TREX::Task::stopExecution(), Transports::Replay::Task::stopReplay(), Control::ROV::HorizontalPlane::Task::tal(), Monitors::LostComms::Task::task(), Sensors::SW100::Task::task(), Vision::FrameGrabber::Task::task(), Sensors::AIM104MultiIO::Task::task(), Monitors::Medium::Task::task(), Supervisors::Vehicle::Task::task(), Sensors::Microstrain3DMGX3::Task::task(), Monitors::FuelLevel::Task::task(), Control::UAV::RemoteOperation::Task::update(), updateParameters(), and Plan::Engine::Task::vehicleRequest().

void DUNE::Tasks::Task::dispatch ( IMC::Message msg,
unsigned int  flags = 0 
)
inline

Dispatch message to the message bus.

Parameters
[in]msgmessage reference.
[in]flagsbitfield with flags (see DispatchFlags).

References dispatch().

void DUNE::Tasks::Task::dispatchReply ( const IMC::Message original,
IMC::Message msg,
unsigned int  flags = 0 
)
inline

Dispatch message to the message bus in reply to another message.

Parameters
[in]originaloriginal message.
[in]msgmessage reference.
[in]flagsbitfield with flags (see DispatchFlags).

References dispatch(), DUNE::IMC::Message::getSource(), DUNE::IMC::Message::getSourceEntity(), DUNE::IMC::Message::setDestination(), and DUNE::IMC::Message::setDestinationEntity().

Referenced by Actuators::LED4R::Task::consume().

void Task::err ( const char *  format,
  ... 
)

Send an human-readable error message to all configured output channels and files.

Parameters
formatstring format (similar to printf(3)).
...arguments.

References DUNE::IMC::LogBookEntry::LBET_ERROR.

Referenced by Supervisors::Vehicle::Task::answer(), Plan::DB::Task::answer(), Plan::Engine::Task::answer(), Transports::SerialOverTCP::Task::checkClientSockets(), Transports::SerialOverTCP::Task::checkMainSocket(), DUNE::Control::BasicAutopilot::consume(), Transports::LogBook::Task::consume(), DUNE::Control::PathController::consume(), Monitors::Clock::Task::consume(), Supervisors::Vehicle::Task::consume(), Transports::Replay::Task::consume(), Monitors::Entities::Task::consume(), Transports::GSM::Task::consume(), Plan::Engine::Task::consume(), Control::UAV::Ardupilot::Task::consume(), Transports::Cache::Task::copySnapshot(), DUNE::Daemon::Daemon(), Transports::SerialOverTCP::Task::dispatchToClients(), Monitors::Entities::Task::enable(), Autonomy::TextActions::Task::handleAbortCommand(), Control::UAV::Ardupilot::Task::handleArdupilotData(), Sensors::MLBL::Task::handleMiniPacket(), Transports::IridiumSBD::Task::handleSBD(), Sensors::MLBLTracker::Task::hasTransducer(), initializeResources(), loadConfig(), Plan::Engine::Task::lookForPlan(), Sensors::XR620CTD::Task::onMain(), Sensors::MLBLTracker::Task::onResourceAcquisition(), Sensors::PTU300::Task::onResourceInitialization(), Sensors::AIM104MultiIO::Task::onResourceInitialization(), Monitors::Entities::Task::onTimeoutCheck(), Control::AUV::LMI::Task::onUpdateParameters(), Monitors::FuelLevel::Task::onUpdateParameters(), Sensors::MTi::Task::parse(), Sensors::Microstrain3DMGX1::Task::parse(), Sensors::Antaris4::Task::parse(), Sensors::MLBL::Task::processInput(), Sensors::MLBLTracker::Task::readSentence(), Sensors::PTU300::Task::sendCommand(), Sensors::Antaris4::Task::sendMessage(), Monitors::OperationalLimits::Task::setError(), Sensors::MTi::Task::setup(), Monitors::Entities::Task::setupDefaults(), DUNE::Control::BasicAutopilot::signalBadVertical(), DUNE::Control::BasicAutopilot::signalBadYaw(), DUNE::Control::PathController::signalError(), DUNE::Tasks::Manager::start(), Transports::Replay::Task::startReplay(), Vision::Lumenera::Task::startVideo(), and Sensors::AIM104MultiIO::Task::task().

uint16_t DUNE::Tasks::Task::getActivationTime ( void  ) const
inline

Retrieve the task's activation time.

Returns
activation time of the task.
uint16_t DUNE::Tasks::Task::getDeactivationTime ( void  ) const
inline

Retrieve the task's deactivation time.

Returns
deactivation time of the task.
const char* DUNE::Tasks::Task::getEntityLabel ( void  ) const
inlineprotected

Retrieve the main entity label of the task.

Returns
main entity label.

Referenced by Actuators::LED4R::Task::onEntityReservation(), Sensors::MLBLTracker::Task::onResourceInitialization(), updateParameters(), and writeParamsXML().

const char* DUNE::Tasks::Task::getName ( void  ) const
inlinevirtual

Retrieve the task's name.

Returns
name of the task.

Implements DUNE::Tasks::AbstractTask.

Referenced by Sensors::Microstrain3DMGX3::Task::consume(), loadConfig(), reserveEntities(), reserveEntity(), and updateParameters().

unsigned int DUNE::Tasks::Task::getPriority ( void  ) const
inline

Get scheduling priority.

The priority of a task might change when configuration parameters are updated.

Returns
task priority.
void Task::inf ( const char *  format,
  ... 
)

Send an human-readable informational message to all configured output channels and files.

Parameters
formatstring format (similar to printf(3)).
...arguments.

References DUNE::IMC::LogBookEntry::LBET_INFO.

Referenced by Monitors::Entities::Task::activate(), Plan::DB::Task::answer(), Plan::Engine::Task::answer(), Transports::SerialOverTCP::Task::checkMainSocket(), DUNE::Tasks::SimpleTransport::consume(), Transports::LogBook::Task::consume(), DUNE::Control::PathController::consume(), Plan::Generator::Task::consume(), Autonomy::TREX::Task::consume(), Monitors::OperationalLimits::Task::consume(), Monitors::Entities::Task::consume(), Sensors::Antaris4::Task::consume(), Control::PTU::Task::consume(), Plan::Engine::Task::consume(), DUNE::Daemon::Daemon(), Monitors::Entities::Task::disable(), Monitors::Entities::Task::enable(), Plan::Generator::Task::generate(), Sensors::MLBLTracker::Task::handleCAMUA(), DUNE::Tasks::SimpleTransport::handleData(), Sensors::MLBL::Task::handleMiniPacket(), Autonomy::TextActions::Task::handlePlanCommand(), Autonomy::TREX::Task::onActivation(), Autonomy::TREX::Task::onDeactivation(), Sensors::MLBL::Task::onEntityResolution(), Sensors::GillWindObserverII::Task::onMain(), Sensors::DLV3::Task::onMain(), Plan::DB::Task::onResourceAcquisition(), Actuators::LED4R::Task::onResourceAcquisition(), Sensors::IFOG::Task::onResourceAcquisition(), Transports::UDP::Task::onResourceAcquisition(), Transports::Discovery::Task::onResourceInitialization(), Sensors::PTU300::Task::onResourceInitialization(), Sensors::Antaris4::Task::onResourceInitialization(), Control::PTU2::Task::onUpdateParameters(), Control::PTU::Task::onUpdateParameters(), Control::UAV::Ardupilot::Task::openConnection(), Transports::GSM::Task::processQueue(), Transports::Discovery::Task::readMessage(), Transports::UDP::Task::refreshContacts(), Sensors::MLBL::Task::reportRanges(), Sensors::Microstrain3DMGX3::Task::runCalibration(), DUNE::Hardware::BasicModem::send(), Sensors::MLBLTracker::Task::sendCommand(), Monitors::Emergency::Task::sendSMS(), Sensors::Microstrain3DMGX3::Task::setHardIron(), Sensors::MTi::Task::setup(), DUNE::Tasks::Manager::start(), Autonomy::TREX::Task::startExecution(), Vision::Lumenera::Task::startVideo(), Sensors::SW100::Task::task(), Supervisors::Vehicle::Task::task(), and DUNE::Daemon::~Daemon().

void Task::initializeResources ( void  )

Instruct task to initialize the resources acquired in acquireResources().

References err(), onResourceInitialization(), stopping(), and DUNE::Time::Delay::wait().

virtual void DUNE::Tasks::Task::onDeactivation ( void  )
inlineprotectedvirtual
virtual void DUNE::Tasks::Task::onEntityReservation ( void  )
inlineprotectedvirtual

Called when the task is instructed to reserve all the entity identifiers it needs for normal execution.

See reserveEntity(). Derived classes that need to reserve entity identifiers other than that of the main entity should override this function.

Reimplemented in Control::AUV::Attitude::Task, Sensors::WorkhorseNavigator::Task, Sensors::AIM104MultiIO::Task, Actuators::LED4R::Task, Transports::IridiumSBD::Task, Transports::Replay::Task, Autonomy::TREX::Task, Control::Path::VectorField::Task, Sensors::DLV3::Task, DUNE::Control::PathController, and Control::Path::PurePursuit::Task.

Referenced by reserveEntities().

virtual void DUNE::Tasks::Task::onEntityResolution ( void  )
inlineprotectedvirtual

Called when the task is instructed to resolve all the entity identifiers it needs for normal execution.

See resolveEntity(). Derived classes that need to resolve entity identifiers should override this function.

Reimplemented in Sensors::MLBL::Task, Monitors::FuelLevel::Task, Navigation::AUV::SGNavigation::Task, Sensors::Microstrain3DMGX3::Task, Navigation::General::Alignment::Task, Control::AUV::Allocator::Task, Navigation::AUV::Navigation::Task, Transports::IridiumSBD::Task, Monitors::Entities::Task, DUNE::Navigation::BasicNavigation, Navigation::General::GPSNavigation::Task, and Task.

Referenced by resolveEntities().

virtual void DUNE::Tasks::Task::onReportEntityState ( void  )
inlineprotectedvirtual

Called when the task is instructed to report the state of its entities.

Derived classes that need to report the state of entities other than the main entity should override this function to dispatch the EntityState of those entities.

Reimplemented in Sensors::MLBL::Task, Navigation::AUV::SGNavigation::Task, Monitors::Entities::Task, and Autonomy::TREX::Task.

virtual void DUNE::Tasks::Task::onRequestActivation ( void  )
inlineprotectedvirtual

Called when an external activation request is received.

Derived classes that need to perform extra steps to prepare normal execution should replace the default behaviour of immediate activation with calls to activate() when the request is completed or activationFailed() if the request cannot be honoured.

Reimplemented in Vision::DFK51BG02H::Task, and Vision::Lumenera::Task.

References activate(), and spew().

Referenced by requestActivation().

virtual void DUNE::Tasks::Task::onRequestDeactivation ( void  )
inlineprotectedvirtual

Called when an external deactivation request is received.

Derived classes that need to perform extra steps to prepare normal execution should replace the default behaviour of immediate deactivation with calls to deactivate() when the request is completed or deactivationFailed() if the request cannot be honoured.

References deactivate(), and spew().

Referenced by requestDeactivation().

virtual void DUNE::Tasks::Task::onResourceInitialization ( void  )
inlineprotectedvirtual

Called when the task is instructed to initialize resources acquired previously or whose initialization depends on run-time parameters.

Reimplemented in Vision::Lumenera::Task, Sensors::MLBL::Task, Vision::DFK51BG02H::Task, Sensors::MLBLTracker::Task, Navigation::AUV::SGNavigation::Task, Sensors::Microstrain3DMGX3::Task, Control::AUV::Attitude::Task, Sensors::IFOG::Task, Sensors::Antaris4::Task, Sensors::OS4000::Task, Navigation::General::Alignment::Task, Actuators::LED4R::Task, Control::AUV::Speed::Task, Plan::Engine::Task, Sensors::WorkhorseNavigator::Task, Sensors::XR620CTD::Task, Transports::IridiumSBD::Task, Transports::GSM::Task, Transports::Announce::Task, Navigation::AUV::Navigation::Task, Sensors::Microstrain3DMGX1::Task, Control::ROV::HorizontalPlane::Task, Navigation::General::ROV::Task, Control::AUV::Allocator::Task, Monitors::Entities::Task, Control::AUV::LMI::Task, Monitors::Medium::Task, DUNE::Navigation::BasicNavigation, Sensors::AIM104MultiIO::Task, Vision::FrameGrabber::Task, Monitors::Clock::Task, Sensors::SW100::Task, DUNE::Control::PathController, Sensors::XchangeSV::Task, Sensors::DLV3::Task, Control::ROV::Depth::Task, Monitors::Emergency::Task, Supervisors::Vehicle::Task, DUNE::Control::BasicRemoteOperation, Sensors::PTU300::Task, Transports::SerialOverTCP::Task, Supervisors::Entities::Task, Transports::Cache::Task, Transports::Discovery::Task, Monitors::CPU::Task, Monitors::LostComms::Task, Sensors::MiniSVS::Task, Transports::Iridium::Task, Transports::LogBook::Task, DUNE::Maneuvers::Maneuver, DUNE::Control::BasicAutopilot, DUNE::Daemon, and Autonomy::TextActions::Task.

Referenced by initializeResources().

template<typename T >
Parameter& DUNE::Tasks::Task::param ( const std::string &  name,
T &  var 
)
inlineprotected

Declare a configuration parameter that can be parsed using the basic parameter parser.

Template Parameters
Ttype of the destination variable.
Parameters
[in]nameparameter name.
[in]varvariable that will hold the parameter value.
Returns
Parameter object.

Referenced by DUNE::Control::BasicAutopilot::BasicAutopilot(), DUNE::Navigation::BasicNavigation::BasicNavigation(), DUNE::Control::BasicRemoteOperation::BasicRemoteOperation(), paramActive(), DUNE::Control::PathController::PathController(), DUNE::Tasks::Periodic::Periodic(), DUNE::Tasks::SimpleTransport::SimpleTransport(), Task::Task(), Control::PTU2::Task::Task(), Vision::PhotoTrigger::Task::Task(), Sensors::PPS::Task::Task(), Transports::Iridium::Task::Task(), Monitors::CPU::Task::Task(), Control::UAV::RemoteOperation::Task::Task(), Sensors::GillWindObserverII::Task::Task(), Control::PTU::Task::Task(), Control::ROV::RemoteOperation::Task::Task(), Sensors::MiniSVS::Task::Task(), Transports::Cache::Task::Task(), Control::Path::Aerosonde::Task::Task(), Sensors::PTU300::Task::Task(), Sensors::XchangeSV::Task::Task(), Transports::SerialOverTCP::Task::Task(), Sensors::EmulatedGPS::Task::Task(), Monitors::LostComms::Task::Task(), Transports::Discovery::Task::Task(), Transports::LoggingDigest::Task::Task(), Sensors::DLV3::Task::Task(), Control::Path::VectorField::Task::Task(), Supervisors::Entities::Task::Task(), Vision::FrameGrabber::Task::Task(), Control::ROV::Depth::Task::Task(), Monitors::Emergency::Task::Task(), Navigation::General::GPSNavigation::Task::Task(), Plan::Generator::Task::Task(), Control::AUV::Allocator::Task::Task(), Sensors::SW100::Task::Task(), Control::AUV::RemoteOperation::Task::Task(), Sensors::AIM104MultiIO::Task::Task(), Transports::IridiumSBD::Task::Task(), Control::ROV::HorizontalPlane::Task::Task(), Autonomy::TREX::Task::Task(), Monitors::Medium::Task::Task(), Supervisors::Vehicle::Task::Task(), Control::AUV::LMI::Task::Task(), Sensors::WorkhorseNavigator::Task::Task(), Navigation::AUV::Navigation::Task::Task(), Monitors::Clock::Task::Task(), Simulators::UAV::Task::Task(), Vision::Lumenera::Task::Task(), Transports::Replay::Task::Task(), Transports::GSM::Task::Task(), Sensors::MTi::Task::Task(), Navigation::General::ROV::Task::Task(), Monitors::Entities::Task::Task(), Transports::Announce::Task::Task(), Plan::DB::Task::Task(), Task(), Control::AUV::Speed::Task::Task(), Plan::Engine::Task::Task(), Monitors::OperationalLimits::Task::Task(), Actuators::LED4R::Task::Task(), Transports::UDP::Task::Task(), Sensors::Microstrain3DMGX1::Task::Task(), Sensors::OS4000::Task::Task(), Navigation::General::Alignment::Task::Task(), Control::AUV::Attitude::Task::Task(), Sensors::IFOG::Task::Task(), Sensors::XR620CTD::Task::Task(), Control::UAV::Ardupilot::Task::Task(), Sensors::Microstrain3DMGX3::Task::Task(), Sensors::MLBLTracker::Task::Task(), Monitors::FuelLevel::Task::Task(), Navigation::AUV::SGNavigation::Task::Task(), Sensors::Antaris4::Task::Task(), Vision::DFK51BG02H::Task::Task(), and Sensors::MLBL::Task::Task().

template<typename Y , typename T >
Parameter& DUNE::Tasks::Task::param ( const std::string &  name,
T &  var 
)
inlineprotected

Declare a configuration parameter that can be parsed using a custom parameter reader.

Template Parameters
Ytype of the custom parameter reader.
Ttype of the destination variable.
Parameters
[in]nameparameter name.
[in]varvariable that will hold the parameter value.
Returns
Parameter object.

References DUNE::Tasks::ParameterTable::add().

void Task::paramActive ( Parameter::Scope  def_scope,
Parameter::Visibility  def_visibility,
bool  def_value = false 
)
protected

Declare parameter 'Active' and associated parameters 'Active.

  • Scope' and 'Active - Visibility'. These parameters allows the task to be activated/deactivated using the message SetEntityParameters.
    Parameters
    [in]def_scopedefault scope of 'Active' parameter.
    [in]def_visibilitydefault visibility of 'Active' parameter.
    [in]def_valuedefault value of 'Active' parameter.

References DUNE::Tasks::Parameter::defaultValue(), param(), DUNE::Tasks::Parameter::scope(), DUNE::Tasks::Parameter::SCOPE_GLOBAL, DUNE::Tasks::Parameter::scopeToString(), DUNE::uncastLexical(), DUNE::Tasks::Parameter::visibility(), DUNE::Tasks::Parameter::VISIBILITY_DEVELOPER, and DUNE::Tasks::Parameter::visibilityToString().

Referenced by Vision::PhotoTrigger::Task::Task(), Autonomy::TREX::Task::Task(), Sensors::WorkhorseNavigator::Task::Task(), Vision::Lumenera::Task::Task(), Sensors::IFOG::Task::Task(), Vision::DFK51BG02H::Task::Task(), and Sensors::MLBL::Task::Task().

void DUNE::Tasks::Task::receive ( const IMC::Message msg)
inlinevirtual

Queue a message for later consumption.

Parameters
msgmessage object.

Implements DUNE::Tasks::AbstractTask.

References DUNE::Tasks::Recipient::put().

void Task::releaseResources ( void  )

Free all resources acquired in acquireResources().

References onResourceRelease().

void Task::reserveEntities ( void  )

Instruct task to reserve all entity identifiers that it needs for normal execution.

References DUNE::Tasks::Context::entities, getName(), m_ctx, onEntityReservation(), and DUNE::Tasks::EntityDataBase::reserve().

Referenced by DUNE::Daemon::Daemon().

void Task::resolveEntities ( void  )

Instruct task to resolve all entity identifiers that it needs for normal execution.

References onEntityResolution().

std::string Task::resolveEntity ( unsigned int  id) const
protected

Retrieve the entity label of a given entity id.

Parameters
[in]identity id.
Exceptions
NonexistentIdif the id doesn't have an associated label.
Returns
entity label.

References DUNE::Tasks::Context::entities, m_ctx, and DUNE::Tasks::EntityDataBase::resolve().

const char* DUNE::Tasks::Task::resolveSystemId ( unsigned int  id) const
inline
unsigned int DUNE::Tasks::Task::resolveSystemName ( const std::string &  name) const
inline

Retrieve the identifier associated with a given system name.

Parameters
[in]namesystem name.
Returns
system identifier.

References m_ctx, DUNE::IMC::AddressResolver::resolve(), and DUNE::Tasks::Context::resolver.

Referenced by DUNE::Daemon::Daemon(), Control::PTU2::Task::onUpdateParameters(), Control::PTU::Task::onUpdateParameters(), and Sensors::MLBLTracker::Task::Task().

void DUNE::Tasks::Task::setEntityLabel ( const std::string &  label)
inlineprotected

Set the main entity label of the task.

Parameters
[in]labelmain entity label.

Referenced by DUNE::Daemon::Daemon().

void Task::setEntityState ( IMC::EntityState::StateEnum  state,
Status::Code  code 
)
protected

Set current entity state with an optional pre-defined description.

If a status code is not given, then the existing description will be kept.

Parameters
[in]stateentity state.
[in]codestatus code.

References DUNE::IMC::EntityState::description, dispatch(), DUNE::Status::getString(), and DUNE::IMC::EntityState::state.

Referenced by DUNE::Control::BasicAutopilot::BasicAutopilot(), DUNE::Navigation::BasicNavigation::checkUncertainty(), DUNE::Control::BasicRemoteOperation::consume(), DUNE::Control::BasicAutopilot::consume(), Monitors::CPU::Task::consume(), Control::PTU2::Task::consume(), Plan::Generator::Task::consume(), Monitors::Clock::Task::consume(), Control::PTU::Task::consume(), Navigation::General::GPSNavigation::Task::consume(), Plan::Engine::Task::consume(), Navigation::General::Alignment::Task::consume(), Plan::DB::Task::consume(), Sensors::OS4000::Task::consume(), Control::UAV::Ardupilot::Task::handleArdupilotData(), DUNE::Control::BasicAutopilot::onActivation(), Vision::Lumenera::Task::onActivation(), Autonomy::TREX::Task::onActivation(), Vision::DFK51BG02H::Task::onActivation(), DUNE::Control::BasicAutopilot::onDeactivation(), Vision::Lumenera::Task::onDeactivation(), Autonomy::TREX::Task::onDeactivation(), Sensors::IFOG::Task::onDeactivation(), Vision::DFK51BG02H::Task::onDeactivation(), Sensors::MiniSVS::Task::onMain(), Sensors::XchangeSV::Task::onMain(), Navigation::General::GPSNavigation::Task::onMain(), Monitors::Clock::Task::onMain(), Sensors::WorkhorseNavigator::Task::onMain(), Sensors::IFOG::Task::onMain(), Actuators::LED4R::Task::onMain(), Sensors::XR620CTD::Task::onMain(), Sensors::OS4000::Task::onMain(), Sensors::Microstrain3DMGX1::Task::onMain(), Navigation::General::Alignment::Task::onMain(), Control::UAV::Ardupilot::Task::onMain(), Sensors::MLBLTracker::Task::onMain(), Autonomy::TREX::Task::onReportEntityState(), Sensors::MiniSVS::Task::onResourceAcquisition(), Sensors::XchangeSV::Task::onResourceAcquisition(), Plan::DB::Task::onResourceAcquisition(), Transports::UDP::Task::onResourceAcquisition(), Sensors::Microstrain3DMGX3::Task::onResourceAcquisition(), Sensors::MLBLTracker::Task::onResourceAcquisition(), Autonomy::TextActions::Task::onResourceInitialization(), DUNE::Daemon::onResourceInitialization(), DUNE::Maneuvers::Maneuver::onResourceInitialization(), Transports::LogBook::Task::onResourceInitialization(), Transports::Iridium::Task::onResourceInitialization(), Sensors::MiniSVS::Task::onResourceInitialization(), Monitors::LostComms::Task::onResourceInitialization(), Transports::Cache::Task::onResourceInitialization(), Supervisors::Entities::Task::onResourceInitialization(), DUNE::Control::BasicRemoteOperation::onResourceInitialization(), Monitors::Emergency::Task::onResourceInitialization(), Sensors::XchangeSV::Task::onResourceInitialization(), Monitors::Entities::Task::onResourceInitialization(), Transports::Announce::Task::onResourceInitialization(), Transports::GSM::Task::onResourceInitialization(), Transports::IridiumSBD::Task::onResourceInitialization(), Sensors::WorkhorseNavigator::Task::onResourceInitialization(), Actuators::LED4R::Task::onResourceInitialization(), Sensors::OS4000::Task::onResourceInitialization(), Sensors::IFOG::Task::onResourceInitialization(), Sensors::Microstrain3DMGX3::Task::onResourceInitialization(), Vision::DFK51BG02H::Task::onResourceInitialization(), Control::UAV::Ardupilot::Task::openConnection(), Plan::Engine::Task::openDB(), Sensors::MLBLTracker::Task::readSentence(), Monitors::OperationalLimits::Task::reset(), DUNE::Navigation::BasicNavigation::reset(), Sensors::Microstrain3DMGX3::Task::runCalibration(), Supervisors::Vehicle::Task::setInitialState(), Sensors::Microstrain3DMGX1::Task::setup(), DUNE::Control::BasicAutopilot::signalBadVertical(), DUNE::Control::BasicAutopilot::signalBadYaw(), Sensors::WorkhorseNavigator::Task::startSampling(), Sensors::XR620CTD::Task::startSampling(), Sensors::XR620CTD::Task::stopSampling(), Monitors::CPU::Task::Task(), Control::AUV::Allocator::Task::Task(), Monitors::Clock::Task::Task(), Task(), Control::AUV::Speed::Task::Task(), Navigation::General::Alignment::Task::Task(), Sensors::SW100::Task::task(), Monitors::Medium::Task::task(), Sensors::Microstrain3DMGX3::Task::task(), Monitors::FuelLevel::Task::task(), Sensors::OS4000::Task::terminateCalibration(), and Monitors::OperationalLimits::Task::updateState().

void Task::setEntityState ( IMC::EntityState::StateEnum  state,
const std::string &  description 
)
protected

Set current entity state with a custom description.

Parameters
[in]stateentity state.
[in]descriptioncustom state description.

References DUNE::IMC::EntityState::description, dispatch(), and DUNE::IMC::EntityState::state.

void DUNE::Tasks::Task::setParamSectionEditor ( const std::string &  name)
inlineprotected

Set the name of the parameter editor that should be used to interact with the parameters of the task.

Parameters
[in]nameeditor name (free-form string).
void DUNE::Tasks::Task::setPriority ( unsigned int  value)
inline

Set scheduling priority programatically.

The priority of a task might change when configuration parameters are updated.

Parameters
[in]valuedesired scheduling priority.
bool DUNE::Tasks::Task::stopping ( void  )
inlineprotected

Test if task is stopping.

Returns
true if task is stopping, false otherwise.

References DUNE::Concurrency::Runnable::isStopping().

Referenced by Sensors::XR620CTD::Task::getCalibration(), initializeResources(), DUNE::Tasks::SimpleTransport::onMain(), DUNE::Daemon::onMain(), Vision::PhotoTrigger::Task::onMain(), Sensors::GillWindObserverII::Task::onMain(), DUNE::Control::BasicAutopilot::onMain(), Sensors::PPS::Task::onMain(), Sensors::MiniSVS::Task::onMain(), Sensors::DLV3::Task::onMain(), Sensors::XchangeSV::Task::onMain(), Autonomy::TextActions::Task::onMain(), Transports::LogBook::Task::onMain(), Control::PTU2::Task::onMain(), Navigation::General::GPSNavigation::Task::onMain(), Monitors::Clock::Task::onMain(), Transports::SerialOverTCP::Task::onMain(), Sensors::PTU300::Task::onMain(), Transports::Discovery::Task::onMain(), Transports::LoggingDigest::Task::onMain(), Plan::Generator::Task::onMain(), Transports::Iridium::Task::onMain(), Transports::GSM::Task::onMain(), DUNE::Control::PathController::onMain(), Transports::Cache::Task::onMain(), Simulators::UAV::Task::onMain(), Control::PTU::Task::onMain(), Sensors::WorkhorseNavigator::Task::onMain(), Autonomy::TREX::Task::onMain(), Sensors::IFOG::Task::onMain(), Transports::Replay::Task::onMain(), Actuators::LED4R::Task::onMain(), Transports::UDP::Task::onMain(), Transports::IridiumSBD::Task::onMain(), Sensors::XR620CTD::Task::onMain(), Sensors::OS4000::Task::onMain(), Sensors::MTi::Task::onMain(), Vision::Lumenera::Task::onMain(), Transports::Announce::Task::onMain(), Control::AUV::Allocator::Task::onMain(), Control::AUV::Speed::Task::onMain(), Vision::DFK51BG02H::Task::onMain(), Sensors::Microstrain3DMGX1::Task::onMain(), Monitors::Entities::Task::onMain(), Navigation::General::Alignment::Task::onMain(), Sensors::Antaris4::Task::onMain(), Plan::DB::Task::onMain(), Control::UAV::Ardupilot::Task::onMain(), Sensors::MLBLTracker::Task::onMain(), Sensors::MLBL::Task::onMain(), Plan::Engine::Task::onMain(), Sensors::OS4000::Task::onResourceInitialization(), Sensors::Microstrain3DMGX3::Task::onResourceInitialization(), Sensors::OS4000::Task::setParameter(), Sensors::XR620CTD::Task::setParameters(), and Sensors::XR620CTD::Task::stopSampling().

void Task::war ( const char *  format,
  ... 
)
void Task::writeParamsXML ( std::ostream &  os) const

Write task parameters in XML format.

Parameters
[in]osoutput stream.

References getEntityLabel(), and DUNE::Tasks::ParameterTable::writeXML().

Member Data Documentation

Collaboration diagram for DUNE::Tasks::Task:
Collaboration graph