DUNE: Uniform Navigational Environment
2.6.0-rc4
|
Public Member Functions | |
Task (const std::string &name, Tasks::Context &ctx) | |
void | onUpdateParameters (void) |
void | onResourceAcquisition (void) |
void | onResourceRelease (void) |
void | onResourceInitialization (void) |
void | onRequestActivation (void) |
void | onActivation (void) |
void | onDeactivation (void) |
void | checkActivationProgress (void) |
void | consume (const IMC::SoundSpeed *msg) |
uint8_t | getIndex (uint8_t value, const uint8_t *table, uint8_t table_size) |
void | setRange (void) |
void | setStartGain (void) |
void | setAbsorption (float absorption) |
void | setStepSize (void) |
void | setProfile (void) |
void | setDataBits (void) |
void | setDataPoints (void) |
void | setProfileMinRange (void) |
void | setSwitchDelay (void) |
void | setFrequency (uint16_t frequency) |
void | updateState (float heading) |
void | setSectorWidth (void) |
void | setTrainAngle (void) |
void | testComms (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 |
unsigned int | resolveEntity (const std::string &label) const |
std::string | resolveEntity (unsigned int id) 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) |
Public Attributes | |
SerialPort * | m_uart |
Parser | m_parser |
IMC::Distance | m_distance |
IMC::SonarData | m_sonar |
IMC::DeviceState | m_device_state |
uint8_t | m_sdata [c_sdata_size] |
double | m_sound_speed |
IMC::PowerChannelControl | m_power_channel_control |
Counter< double > | m_countdown |
Counter< double > | m_wdog |
Arguments | m_args |
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) |
bool | stopping (void) |
bool | isActive (void) const |
bool | isActivating (void) const |
bool | isDeactivating (void) const |
void | waitForMessages (double timeout) |
void | consumeMessages (void) |
template<typename T > | |
Parameter & | param (const std::string &name, T &var) |
template<typename Y , typename T > | |
Parameter & | param (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 , typename M > | |
void | bind (T *task_obj, const std::vector< uint32_t > &list, void(T::*consumer)(const M *)=&T::consume) |
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 | 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 | |
Context & | m_ctx |
|
inline |
Constructor.
[in] | name | task name. |
[in] | ctx | context. |
References Sensors::Imagenex881A::Arguments::absorption, Sensors::Imagenex881A::Arguments::data_bits, Sensors::Imagenex881A::Arguments::data_points, DUNE::Tasks::Parameter::defaultValue(), Sensors::Imagenex881A::Arguments::frequency, m_args, m_distance, m_sdata, m_sonar, DUNE::Tasks::Task::param(), DUNE::Tasks::Task::paramActive(), Sensors::Imagenex881A::Arguments::position, Sensors::Imagenex881A::Arguments::power_channel, Sensors::Imagenex881A::Arguments::profile, Sensors::Imagenex881A::Arguments::profile_min_range, Sensors::Imagenex881A::Arguments::range, Sensors::Imagenex881A::SD_BAUD_RATE, Sensors::Imagenex881A::SD_HDR_1, Sensors::Imagenex881A::SD_HDR_2, Sensors::Imagenex881A::SD_HEAD_ID, Sensors::Imagenex881A::SD_MASTER_SLAVE, Sensors::Imagenex881A::SD_TERMINATOR, Sensors::Imagenex881A::Arguments::sector_width, Sensors::Imagenex881A::Arguments::sspeed, Sensors::Imagenex881A::Arguments::sspeed_dyn, Sensors::Imagenex881A::Arguments::start_gain, Sensors::Imagenex881A::Arguments::step_size, Sensors::Imagenex881A::Arguments::switch_delay, Sensors::Imagenex881A::Arguments::train_angle, Sensors::Imagenex881A::Arguments::uart_dev, and Sensors::Imagenex881A::Arguments::use_default.
|
inline |
References DUNE::Tasks::Task::activate(), DUNE::Tasks::Task::activationFailed(), DUNE::Tasks::Task::debug(), DUNE::Tasks::Task::getActivationTime(), DUNE::Time::Counter< T >::getRemaining(), m_countdown, m_wdog, DUNE::Time::Counter< T >::overflow(), DUNE::Time::Counter< T >::reset(), and testComms().
Referenced by onMain().
|
inline |
References m_sound_speed.
|
inline |
Get index from table according with given value.
[in] | value | value to be checked in the table. |
[in] | table | vector with parameters. |
[in] | table_size | size of the vector. |
Referenced by setRange().
|
inlinevirtual |
Called when the task starts/resumes normal execution.
Reimplemented from DUNE::Tasks::Task.
References DUNE::Tasks::Task::inf(), and DUNE::Tasks::Task::setEntityState().
|
inlinevirtual |
Called when the task stops normal execution and enters an idleness state.
Reimplemented from DUNE::Tasks::Task.
References DUNE::Tasks::Task::dispatch(), DUNE::Tasks::Task::inf(), m_power_channel_control, and DUNE::Tasks::Task::setEntityState().
|
inlinevirtual |
Main loop.
Implements DUNE::Tasks::Task.
References checkActivationProgress(), DUNE::Tasks::Task::consumeMessages(), DUNE::Tasks::Task::dispatch(), Sensors::Imagenex881A::Parser::getDataPointsCount(), Sensors::Imagenex881A::Parser::getHeadPosition(), Sensors::Imagenex881A::Parser::getProfileRange(), Sensors::Imagenex881A::Parser::getRange(), DUNE::Tasks::Task::isActivating(), DUNE::Tasks::Task::isActive(), m_args, m_distance, m_parser, m_sdata, m_sonar, m_sound_speed, m_uart, m_wdog, DUNE::Time::Counter< T >::overflow(), Sensors::Imagenex881A::Parser::parse(), DUNE::Time::Counter< T >::reset(), DUNE::Tasks::Task::setEntityState(), Sensors::Imagenex881A::Arguments::sspeed_dyn, DUNE::Tasks::Task::stopping(), updateState(), and DUNE::Tasks::Task::waitForMessages().
|
inlinevirtual |
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 from DUNE::Tasks::Task.
References DUNE::Tasks::Task::dispatch(), m_countdown, m_power_channel_control, and DUNE::Time::Counter< T >::reset().
|
inlinevirtual |
Acquire resources.
Reimplemented from DUNE::Tasks::Task.
References m_args, m_uart, m_wdog, DUNE::Tasks::Task::setEntityState(), DUNE::Time::Counter< T >::setTop(), and Sensors::Imagenex881A::Arguments::uart_dev.
|
inlinevirtual |
Called when the task is instructed to initialize resources acquired previously or whose initialization depends on run-time parameters.
Reimplemented from DUNE::Tasks::Task.
References DUNE::Tasks::Task::requestDeactivation(), and DUNE::Tasks::Task::setEntityState().
|
inlinevirtual |
Release resources.
Reimplemented from DUNE::Tasks::Task.
References m_uart, and DUNE::Tasks::Task::requestDeactivation().
|
inlinevirtual |
Update internal state with new parameter values.
Reimplemented from DUNE::Tasks::Task.
References Sensors::Imagenex881A::Arguments::absorption, Sensors::Imagenex881A::Arguments::frequency, DUNE::Tasks::Task::getActivationTime(), m_args, m_countdown, m_device_state, m_distance, m_power_channel_control, m_sound_speed, m_uart, DUNE::Tasks::Task::paramChanged(), Sensors::Imagenex881A::Arguments::position, Sensors::Imagenex881A::Arguments::power_channel, Sensors::Imagenex881A::Arguments::range, setAbsorption(), setDataBits(), setDataPoints(), setFrequency(), setProfile(), setRange(), setSectorWidth(), setStartGain(), setStepSize(), DUNE::Time::Counter< T >::setTop(), setTrainAngle(), Sensors::Imagenex881A::Arguments::sspeed, Sensors::Imagenex881A::Arguments::uart_dev, and Sensors::Imagenex881A::Arguments::use_default.
|
inline |
Set switch data absorption.
[in] | absorption | absorption level. |
References DUNE::Math::abs(), m_sdata, and Sensors::Imagenex881A::SD_ABSORPTION.
Referenced by onUpdateParameters().
|
inline |
Set switch data number of bits per data point.
References Sensors::Imagenex881A::Arguments::data_bits, m_args, m_sdata, m_sonar, and Sensors::Imagenex881A::SD_DATA_BITS.
Referenced by onUpdateParameters().
|
inline |
Set switch data number of data points.
References Sensors::Imagenex881A::Arguments::data_points, m_args, m_sdata, and Sensors::Imagenex881A::SD_DATA_POINTS.
Referenced by onUpdateParameters().
|
inline |
Set switch data frequency.
[in] | frequency | operation frequency. |
References m_distance, m_sdata, m_sonar, and Sensors::Imagenex881A::SD_FREQUENCY.
Referenced by onUpdateParameters().
|
inline |
Set switch data profile mode.
References m_args, m_sdata, Sensors::Imagenex881A::Arguments::profile, and Sensors::Imagenex881A::SD_PROFILE.
Referenced by onUpdateParameters().
|
inline |
Set switch data profile minimum range.
References m_args, m_sdata, Sensors::Imagenex881A::Arguments::profile_min_range, and Sensors::Imagenex881A::SD_PROFILE_MIN_RANGE.
|
inline |
Set switch data range.
References getIndex(), m_args, m_sdata, Sensors::Imagenex881A::Arguments::range, Sensors::Imagenex881A::SD_PULSE_LEN, and Sensors::Imagenex881A::SD_RANGE.
Referenced by onUpdateParameters().
|
inline |
Set switch data sector width.
References m_args, m_sdata, Sensors::Imagenex881A::SD_SECTOR_WIDTH, and Sensors::Imagenex881A::Arguments::sector_width.
Referenced by onUpdateParameters().
|
inline |
Set switch data start gain.
References m_args, m_sdata, Sensors::Imagenex881A::SD_START_GAIN, and Sensors::Imagenex881A::Arguments::start_gain.
Referenced by onUpdateParameters().
|
inline |
Set switch data step size.
References m_args, m_sdata, Sensors::Imagenex881A::SD_STEP_SIZE, and Sensors::Imagenex881A::Arguments::step_size.
Referenced by onUpdateParameters().
|
inline |
Set switch data delay.
References m_args, m_sdata, Sensors::Imagenex881A::SD_SWITCH_DELAY, and Sensors::Imagenex881A::Arguments::switch_delay.
|
inline |
Set switch data train angle.
References m_args, m_sdata, Sensors::Imagenex881A::SD_TRAIN_ANGLE, and Sensors::Imagenex881A::Arguments::train_angle.
Referenced by onUpdateParameters().
|
inline |
Test communication with device.
References m_sdata, and m_uart.
Referenced by checkActivationProgress().
|
inline |
Update state.
[in] | heading | beam orientation. |
References m_device_state, and m_distance.
Referenced by onMain().
Arguments Sensors::Imagenex881A::Task::m_args |
Task arguments.
Referenced by onMain(), onResourceAcquisition(), onUpdateParameters(), setDataBits(), setDataPoints(), setProfile(), setProfileMinRange(), setRange(), setSectorWidth(), setStartGain(), setStepSize(), setSwitchDelay(), setTrainAngle(), and Task().
Counter<double> Sensors::Imagenex881A::Task::m_countdown |
Activation/deactivation timer.
Referenced by checkActivationProgress(), onRequestActivation(), and onUpdateParameters().
IMC::DeviceState Sensors::Imagenex881A::Task::m_device_state |
Device State message.
Referenced by onUpdateParameters(), and updateState().
IMC::Distance Sensors::Imagenex881A::Task::m_distance |
Distance message.
Referenced by onMain(), onUpdateParameters(), setFrequency(), Task(), and updateState().
IMC::PowerChannelControl Sensors::Imagenex881A::Task::m_power_channel_control |
Power channel control.
Referenced by onDeactivation(), onRequestActivation(), and onUpdateParameters().
uint8_t Sensors::Imagenex881A::Task::m_sdata[c_sdata_size] |
IMC::SonarData Sensors::Imagenex881A::Task::m_sonar |
Profile message.
Referenced by onMain(), setDataBits(), setFrequency(), and Task().
double Sensors::Imagenex881A::Task::m_sound_speed |
Last valid sound speed value.
Referenced by consume(), onMain(), and onUpdateParameters().
SerialPort* Sensors::Imagenex881A::Task::m_uart |
Serial port handle.
Referenced by onMain(), onResourceAcquisition(), onResourceRelease(), onUpdateParameters(), and testComms().
Counter<double> Sensors::Imagenex881A::Task::m_wdog |
Watchdog.
Referenced by checkActivationProgress(), onMain(), and onResourceAcquisition().