DUNE: Uniform Navigational Environment  2016.05.0
Monitors::Servos::Task Struct Reference

Public Member Functions

 Task (const std::string &name, Tasks::Context &ctx)
void onUpdateParameters (void)
void onEntityResolution (void)
void onResourceRelease (void)
void onResourceAcquisition (void)
void onResourceInitialization (void)
void consume (const IMC::ServoPosition *msg)
void consume (const IMC::SetServoPosition *msg)
void consume (const IMC::Current *msg)
void testPositionFaults (const IMC::ServoPosition *msg)
void testCurrentFaults (float value, unsigned i)
void updateState (unsigned id)
void onMain (void)

Public Attributes

Arguments m_args
ServoPositionMonitor< float > * m_pos_monitor [c_servo_count]
float m_servo_pos [c_servo_count]
float m_set_servo [c_servo_count]
ServoCurrentMonitor< float > * m_curr_monitor [c_servo_count]
unsigned m_curr_ents [c_servo_count]
std::string m_error_str
uint8_t m_on_fault [c_servo_count]
Time::Counter< float > m_timer

Constructor & Destructor Documentation

Member Function Documentation

void Monitors::Servos::Task::consume ( const IMC::ServoPosition *  msg)
void Monitors::Servos::Task::consume ( const IMC::SetServoPosition *  msg)

References m_set_servo.

void Monitors::Servos::Task::consume ( const IMC::Current *  msg)
void Monitors::Servos::Task::onEntityResolution ( void  )
void Monitors::Servos::Task::onMain ( void  )
void Monitors::Servos::Task::onResourceInitialization ( void  )
void Monitors::Servos::Task::onResourceRelease ( void  )

References m_curr_monitor, and m_pos_monitor.

void Monitors::Servos::Task::testCurrentFaults ( float  value,
unsigned  i 

This method will attempt to detect faults in the servo using electric current readings.

[in]valueelectric current value received
[in]inumber of the servo to test for faults

References Monitors::Servos::FT_CURRENT, m_curr_monitor, m_error_str, m_on_fault, and updateState().

Referenced by consume().

void Monitors::Servos::Task::testPositionFaults ( const IMC::ServoPosition *  msg)
void Monitors::Servos::Task::updateState ( unsigned  id)

Update entity state according to fault states.

[in]idnumber id of the servo

References Monitors::Servos::FT_NONE, m_error_str, and m_on_fault.

Referenced by testCurrentFaults(), and testPositionFaults().

Member Data Documentation

unsigned Monitors::Servos::Task::m_curr_ents[c_servo_count]

Electric current entity ids.

Referenced by consume(), and onEntityResolution().

ServoCurrentMonitor<float>* Monitors::Servos::Task::m_curr_monitor[c_servo_count]
std::string Monitors::Servos::Task::m_error_str

String to hold the last error.

Referenced by testCurrentFaults(), testPositionFaults(), and updateState().

uint8_t Monitors::Servos::Task::m_on_fault[c_servo_count]

Fault mask to keep track of fault types.

Referenced by onResourceInitialization(), testCurrentFaults(), testPositionFaults(), and updateState().

ServoPositionMonitor<float>* Monitors::Servos::Task::m_pos_monitor[c_servo_count]

Position fault detection array.

Referenced by onResourceRelease(), Task(), and testPositionFaults().

float Monitors::Servos::Task::m_servo_pos[c_servo_count]

Servo position.

float Monitors::Servos::Task::m_set_servo[c_servo_count]

Set Servo position values.

Referenced by consume(), onResourceInitialization(), and testPositionFaults().

Time::Counter<float> Monitors::Servos::Task::m_timer

Timer for error timeout.

Referenced by consume(), onMain(), and onResourceInitialization().

Collaboration diagram for Monitors::Servos::Task:
Collaboration graph