DUNE: Uniform Navigational Environment  2020.01.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
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
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.

void Monitors::Servos::Task::testPositionFaults ( const IMC::ServoPosition *  msg)
inline
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, and Monitors::Servos::FT_NONE.

Member Data Documentation

Arguments Monitors::Servos::Task::m_args

Task arguments.

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

Electric current entity ids.

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

Servo Current Fault Monitors.

std::string Monitors::Servos::Task::m_error_str

String to hold the last error.

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

Fault mask to keep track of fault types.

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

Position fault detection array.

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

Queue for error reports.

bool Monitors::Servos::Task::m_servo_fail

Major failure in one of the servos.

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.

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

Timer for error timeout.

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