DUNE: Uniform Navigational Environment  2016.09.0
Actuators::AMC::Task Struct Reference

Public Member Functions

 Task (const std::string &name, Tasks::Context &ctx)
 
void onEntityReservation (void)
 
void onResourceAcquisition (void)
 
void onResourceInitialization (void)
 
void onResourceRelease (void)
 
void consume (const IMC::SetThrusterActuation *msg)
 
bool checkSerialPort (void)
 
int setRPM (int motor, int rpm)
 
int checkStateMotor (bool spew_ok)
 
void checkDataMotor (uint8_t id_motor)
 
void stopAllMotor (void)
 
void readParameterAMC (int motor, AmcMessages fname)
 
void dispatchAllData (uint8_t id)
 
void setRpmValues (void)
 
void task (void)
 

Public Attributes

IMC::Rpm m_rpm [c_max_motors]
 
IMC::Temperature m_tmp [c_max_motors]
 
IMC::Voltage m_volt [c_max_motors]
 
IMC::Current m_amp [c_max_motors]
 
Arguments m_args
 
SerialPort * m_uart
 
Poll m_poll
 
uint8_t m_buffer [c_max_buffer]
 
uint8_t m_csum [c_max_csum]
 
char m_msg [c_max_buffer]
 
Parserm_parse
 
uint8_t m_cnt_motor
 
double m_act [c_numb_motor_id]
 
uint8_t m_fail_uart
 
Time::Counter< float > m_cnt_motor_check
 
double m_tstamp
 

Constructor & Destructor Documentation

Actuators::AMC::Task::Task ( const std::string &  name,
Tasks::Context &  ctx 
)
inline

Member Function Documentation

void Actuators::AMC::Task::checkDataMotor ( uint8_t  id_motor)
inline

Request/read all info of motor to AMC board.

References Actuators::AMC::ALL, checkSerialPort(), dispatchAllData(), m_parse, m_poll, m_uart, readParameterAMC(), and Actuators::AMC::Parser::translate().

Referenced by task().

bool Actuators::AMC::Task::checkSerialPort ( void  )
inline

Read data send by AMC board.

References m_buffer, m_parse, m_poll, m_tstamp, m_uart, and Actuators::AMC::Parser::parse().

Referenced by checkDataMotor(), and checkStateMotor().

void Actuators::AMC::Task::consume ( const IMC::SetThrusterActuation *  msg)
inline

Consume message IMC::SetThrusterActuation.

References m_act.

void Actuators::AMC::Task::onEntityReservation ( void  )
inline
void Actuators::AMC::Task::onResourceAcquisition ( void  )
inline
void Actuators::AMC::Task::onResourceInitialization ( void  )
inline
void Actuators::AMC::Task::onResourceRelease ( void  )
inline

Release resources.

References m_parse, m_poll, and m_uart.

void Actuators::AMC::Task::readParameterAMC ( int  motor,
AmcMessages  fname 
)
inline
int Actuators::AMC::Task::setRPM ( int  motor,
int  rpm 
)
inline

Send value of rpm to motor.

References m_csum, m_msg, and m_uart.

Referenced by setRpmValues(), and stopAllMotor().

void Actuators::AMC::Task::setRpmValues ( void  )
inline
void Actuators::AMC::Task::stopAllMotor ( void  )
inline

Stop all motors.

References m_args, Actuators::AMC::Arguments::motor_state, and setRPM().

Referenced by onResourceInitialization().

Member Data Documentation

double Actuators::AMC::Task::m_act[c_numb_motor_id]

Values for motors.

Referenced by consume(), and setRpmValues().

IMC::Current Actuators::AMC::Task::m_amp[c_max_motors]

Current message.

Referenced by dispatchAllData(), and onEntityReservation().

uint8_t Actuators::AMC::Task::m_buffer[c_max_buffer]

Scratch buffer.

Referenced by checkSerialPort().

uint8_t Actuators::AMC::Task::m_cnt_motor

Counter stage id motor.

Referenced by onResourceInitialization().

Time::Counter<float> Actuators::AMC::Task::m_cnt_motor_check

state time to check state of motors

Referenced by onResourceInitialization(), and task().

uint8_t Actuators::AMC::Task::m_csum[c_max_csum]

CSUM value.

Referenced by readParameterAMC(), and setRPM().

uint8_t Actuators::AMC::Task::m_fail_uart

count for fail rx uart

Referenced by checkStateMotor(), and onResourceInitialization().

char Actuators::AMC::Task::m_msg[c_max_buffer]

Buffer for message received.

Referenced by readParameterAMC(), and setRPM().

Poll Actuators::AMC::Task::m_poll
IMC::Rpm Actuators::AMC::Task::m_rpm[c_max_motors]

Rpm message.

Referenced by dispatchAllData(), and onEntityReservation().

IMC::Temperature Actuators::AMC::Task::m_tmp[c_max_motors]

Temperature message.

Referenced by dispatchAllData(), and onEntityReservation().

double Actuators::AMC::Task::m_tstamp

Read timestamp.

Referenced by checkSerialPort(), and dispatchAllData().

SerialPort* Actuators::AMC::Task::m_uart
IMC::Voltage Actuators::AMC::Task::m_volt[c_max_motors]

Voltage message.

Referenced by dispatchAllData(), and onEntityReservation().

Collaboration diagram for Actuators::AMC::Task:
Collaboration graph