DUNE: Uniform Navigational Environment  2016.09.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
 
std::queue< double > m_queue [c_servo_count]
 
bool m_servo_fail
 

Constructor & Destructor Documentation

Member Function Documentation

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

References m_set_servo.

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

References m_curr_monitor, and m_pos_monitor.

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

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

Parameters
[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::updateState ( unsigned  id)
inline

Update entity state according to fault states.

Parameters
[in]idnumber id of the servo

References Monitors::Servos::Arguments::error_count, Monitors::Servos::FT_NONE, m_args, m_error_str, m_on_fault, m_queue, and m_servo_fail.

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

std::queue<double> Monitors::Servos::Task::m_queue[c_servo_count]

Queue for error reports.

Referenced by testPositionFaults(), and updateState().

bool Monitors::Servos::Task::m_servo_fail

Major failure in one of the servos.

Referenced by onMain(), and updateState().

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