DUNE: Uniform Navigational Environment  2016.09.0
Sensors::Imagenex881A::Task Struct Reference

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
 
DebugLevel getDebugLevel (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
 
const char * getEntityLabel (void) const
 
void setEntityLabel (const std::string &label)
 
- 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)
 
unsigned getPriority (void)
 
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
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)
 
template<typename E >
E * 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 >
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 , 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 bool onWriteParamsXML (std::ostream &os) const
 
virtual void onEntityReservation (void)
 
virtual void onEntityResolution (void)
 
virtual void onReportEntityState (void)
 
virtual void onRequestDeactivation (void)
 
virtual void onQueryEntityParameters (const IMC::QueryEntityParameters *msg)
 
virtual void onSetEntityParameters (const IMC::SetEntityParameters *msg)
 
virtual void onPushEntityParameters (const IMC::PushEntityParameters *msg)
 
virtual void onPopEntityParameters (const IMC::PopEntityParameters *msg)
 
- Protected Member Functions inherited from DUNE::Concurrency::Thread
void startImpl (void)
 
void stopImpl (void)
 
void joinImpl (void)
 
void setPriorityImpl (Scheduler::Policy policy, unsigned priority)
 
unsigned getPriorityImpl (void)
 
- Protected Attributes inherited from DUNE::Tasks::Task
Contextm_ctx
 
std::vector
< Entities::BasicEntity * > 
m_entities
 

Constructor & Destructor Documentation

Member Function Documentation

void Sensors::Imagenex881A::Task::consume ( const IMC::SoundSpeed *  msg)
inline

References m_sound_speed.

uint8_t Sensors::Imagenex881A::Task::getIndex ( uint8_t  value,
const uint8_t *  table,
uint8_t  table_size 
)
inline

Get index from table according with given value.

Parameters
[in]valuevalue to be checked in the table.
[in]tablevector with parameters.
[in]table_sizesize of the vector.
Returns
index of the vector.

Referenced by setRange().

void Sensors::Imagenex881A::Task::onActivation ( void  )
inlinevirtual

Called when the task starts/resumes normal execution.

Reimplemented from DUNE::Tasks::Task.

References DUNE::Tasks::Task::inf(), and DUNE::Tasks::Task::setEntityState().

void Sensors::Imagenex881A::Task::onDeactivation ( void  )
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().

void Sensors::Imagenex881A::Task::onRequestActivation ( void  )
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().

void Sensors::Imagenex881A::Task::onResourceAcquisition ( void  )
inlinevirtual
void Sensors::Imagenex881A::Task::onResourceInitialization ( void  )
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().

void Sensors::Imagenex881A::Task::onResourceRelease ( void  )
inlinevirtual

Release resources.

Reimplemented from DUNE::Tasks::Task.

References m_uart, and DUNE::Tasks::Task::requestDeactivation().

void Sensors::Imagenex881A::Task::setAbsorption ( float  absorption)
inline

Set switch data absorption.

Parameters
[in]absorptionabsorption level.

References DUNE::Math::abs(), m_sdata, and Sensors::Imagenex881A::SD_ABSORPTION.

Referenced by onUpdateParameters().

void Sensors::Imagenex881A::Task::setDataBits ( void  )
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().

void Sensors::Imagenex881A::Task::setDataPoints ( void  )
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().

void Sensors::Imagenex881A::Task::setFrequency ( uint16_t  frequency)
inline

Set switch data frequency.

Parameters
[in]frequencyoperation frequency.

References m_distance, m_sdata, m_sonar, and Sensors::Imagenex881A::SD_FREQUENCY.

Referenced by onUpdateParameters().

void Sensors::Imagenex881A::Task::setProfile ( void  )
inline
void Sensors::Imagenex881A::Task::setProfileMinRange ( void  )
inline
void Sensors::Imagenex881A::Task::setRange ( void  )
inline
void Sensors::Imagenex881A::Task::setSectorWidth ( void  )
inline
void Sensors::Imagenex881A::Task::setStartGain ( void  )
inline
void Sensors::Imagenex881A::Task::setStepSize ( void  )
inline
void Sensors::Imagenex881A::Task::setSwitchDelay ( void  )
inline
void Sensors::Imagenex881A::Task::setTrainAngle ( void  )
inline
void Sensors::Imagenex881A::Task::testComms ( void  )
inline

Test communication with device.

References m_sdata, and m_uart.

Referenced by checkActivationProgress().

void Sensors::Imagenex881A::Task::updateState ( float  heading)
inline

Update state.

Parameters
[in]headingbeam orientation.

References m_device_state, and m_distance.

Referenced by onMain().

Member Data Documentation

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

Parser Sensors::Imagenex881A::Task::m_parser

Response frame parser.

Referenced by onMain().

IMC::PowerChannelControl Sensors::Imagenex881A::Task::m_power_channel_control

Power channel control.

Referenced by onDeactivation(), onRequestActivation(), and onUpdateParameters().

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
Counter<double> Sensors::Imagenex881A::Task::m_wdog
Collaboration diagram for Sensors::Imagenex881A::Task:
Collaboration graph