DUNE: Uniform Navigational Environment  2016.05.0
Actuators::Broom::Task Struct Reference

Public Member Functions

 Task (const std::string &name, Tasks::Context &ctx)
void onUpdateParameters (void)
 ~Task (void)
void onEntityReservation (void)
void onResourceAcquisition (void)
void setup (void)
bool getEEPROM (uint8_t command, const uint8_t *data=NULL, size_t data_size=0)
bool updateConfigArea (uint8_t command, std::vector< uint8_t > &dev_values, const std::vector< uint8_t > &new_values)
bool setupConfigGeneral (void)
bool setupConfigDCYC (void)
bool setupConfigIADC (void)
bool setupConfigERPM (void)
void onCommand (uint8_t cmd, const uint8_t *data, int data_size)
void onVersion (unsigned major, unsigned minor, unsigned patch)
int16_t sanitizeRef (int16_t value)
void setRefDcycle (float value)
void setRefCurrent (float value)
void setRefRPM (int value)
void setRefThrust (float value)
void consume (const IMC::SetThrusterActuation *msg)
void consume (const IMC::DesiredSpeed *msg)
bool waitForCommand (uint8_t code)
void reportEntityState (void)
void task (void)

Public Attributes

Hardware::LUCL::Protocol m_proto
int16_t m_actuation
DevControlModes m_ctl_mode
DevControlModes m_thrust_ctl_mode
IMC::Rpm m_rpms
Entities::BasicEntity * m_motor_ent
Entities::BasicEntity * m_bridge_ent
Entities::BasicEntity * m_mcu_ent
uint8_t m_dev_errors
unsigned m_motor_id
bool m_legacy
Counter< double > m_boot_timer
Counter< double > m_state_timer
Counter< double > m_wdog
Counter< double > m_wdog_setup
Counter< double > m_estate_timer
size_t m_sample_count
size_t m_faults_count
size_t m_timeout_count
std::vector< unsigned > m_version
std::vector< uint8_t > m_eep_config
std::vector< uint8_t > m_eep_dcyc
std::vector< uint8_t > m_eep_iadc
std::vector< uint8_t > m_eep_erpm
SetupState m_setup_state
Arguments m_args

Constructor & Destructor Documentation

Actuators::Broom::Task::~Task ( void  )

Member Function Documentation

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

References m_motor_id, and setRefThrust().

void Actuators::Broom::Task::consume ( const IMC::DesiredSpeed *  msg)
bool Actuators::Broom::Task::getEEPROM ( uint8_t  command,
const uint8_t *  data = NULL,
size_t  data_size = 0 
void Actuators::Broom::Task::onResourceAcquisition ( void  )
void Actuators::Broom::Task::onVersion ( unsigned  major,
unsigned  minor,
unsigned  patch 

References m_legacy, and m_version.

Referenced by waitForCommand().

int16_t Actuators::Broom::Task::sanitizeRef ( int16_t  value)

Sanitize the actuation reference (limits and sign)

[in]valueactuation reference value to be sanitized

References Actuators::Broom::Arguments::inv_rotation, m_args, and DUNE::Math::trimValue().

Referenced by setRefCurrent(), setRefDcycle(), and setRefRPM().

void Actuators::Broom::Task::setRefCurrent ( float  value)

Set phase current value as actuation reference.

[in]valuephase current reference in Ampere

References Actuators::Broom::Arguments::ctl_iadc_max, m_actuation, m_args, m_ctl_mode, Actuators::Broom::MODE_CURRENT, sanitizeRef(), and DUNE::Math::trimValue().

Referenced by setRefThrust().

void Actuators::Broom::Task::setRefDcycle ( float  value)

Set percentage of duty cycle as actuation reference.

[in]valuepercentage reference from -1.0 to 1.0

References m_actuation, m_ctl_mode, Actuators::Broom::MODE_VOLTAGE, sanitizeRef(), and DUNE::Math::trimValue().

Referenced by setRefThrust().

void Actuators::Broom::Task::setRefRPM ( int  value)

Set rotor Rotations Per Minute value as actuation reference.

[in]valuerotor angular velocity reference in Rotations Per Minute

References m_actuation, m_args, m_ctl_mode, Actuators::Broom::MODE_RPM, Actuators::Broom::Arguments::pole_pairs, and sanitizeRef().

Referenced by consume(), and setRefThrust().

void Actuators::Broom::Task::setRefThrust ( float  value)

Set thrust actuation reference, using the mode configured for the task.

[in]valuepercentage of thrust from -1 to 1

References Actuators::Broom::Arguments::ctl_iadc_max, m_args, m_ctl_mode, m_thrust_ctl_mode, Actuators::Broom::Arguments::max_rpm, Actuators::Broom::MODE_CURRENT, Actuators::Broom::MODE_NONE, Actuators::Broom::MODE_RPM, Actuators::Broom::MODE_VOLTAGE, setRefCurrent(), setRefDcycle(), and setRefRPM().

Referenced by consume().

bool Actuators::Broom::Task::updateConfigArea ( uint8_t  command,
std::vector< uint8_t > &  dev_values,
const std::vector< uint8_t > &  new_values 
bool Actuators::Broom::Task::waitForCommand ( uint8_t  code)

Member Data Documentation

int16_t Actuators::Broom::Task::m_actuation

Actuation command.

Referenced by setRefCurrent(), setRefDcycle(), setRefRPM(), and task().

Counter<double> Actuators::Broom::Task::m_boot_timer

Used to silence some spurious boot errors.

Referenced by onCommand(), onResourceAcquisition(), and reportEntityState().

Entities::BasicEntity* Actuators::Broom::Task::m_bridge_ent

Bridge entity.

Referenced by onCommand(), and onEntityReservation().

DevControlModes Actuators::Broom::Task::m_ctl_mode
uint8_t Actuators::Broom::Task::m_dev_errors

Device error mask.

Referenced by getEEPROM(), onCommand(), reportEntityState(), and task().

std::vector<uint8_t> Actuators::Broom::Task::m_eep_config

EEPROM - General Config Area.

Referenced by onCommand(), and setupConfigGeneral().

std::vector<uint8_t> Actuators::Broom::Task::m_eep_dcyc

EEPROM - DCYC Config Area.

Referenced by onCommand(), and setupConfigDCYC().

std::vector<uint8_t> Actuators::Broom::Task::m_eep_erpm

EEPROM - RPM Config Area.

Referenced by onCommand(), and setupConfigERPM().

std::vector<uint8_t> Actuators::Broom::Task::m_eep_iadc

EEPROM - IADC Config Area.

Referenced by onCommand(), and setupConfigIADC().

Counter<double> Actuators::Broom::Task::m_estate_timer

Entity state timer.

Referenced by reportEntityState().

size_t Actuators::Broom::Task::m_faults_count

Faults count.

Referenced by reportEntityState(), and waitForCommand().

bool Actuators::Broom::Task::m_legacy

Enable legacy protocol.

Referenced by onCommand(), and onVersion().

Entities::BasicEntity* Actuators::Broom::Task::m_mcu_ent

MCU entity.

Referenced by onCommand(), and onEntityReservation().

Entities::BasicEntity* Actuators::Broom::Task::m_motor_ent

Motor entity.

Referenced by onCommand(), and onEntityReservation().

unsigned Actuators::Broom::Task::m_motor_id

Motor identifier.

Referenced by consume(), and onUpdateParameters().

Hardware::LUCL::Protocol Actuators::Broom::Task::m_proto

Device protocol handler.

Referenced by getEEPROM(), onCommand(), onResourceAcquisition(), setup(), task(), and waitForCommand().

IMC::Rpm Actuators::Broom::Task::m_rpms

RPMs message.

size_t Actuators::Broom::Task::m_sample_count

Sample count.

Referenced by reportEntityState(), and waitForCommand().

SetupState Actuators::Broom::Task::m_setup_state

Setup state.

Referenced by setup(), and task().

Counter<double> Actuators::Broom::Task::m_state_timer

State update timer.

Referenced by onUpdateParameters(), and task().

DevControlModes Actuators::Broom::Task::m_thrust_ctl_mode

Thrust control mode.

Referenced by onUpdateParameters(), and setRefThrust().

size_t Actuators::Broom::Task::m_timeout_count

Timeout count.

Referenced by getEEPROM(), reportEntityState(), and task().

std::vector<unsigned> Actuators::Broom::Task::m_version


Referenced by onVersion(), and setup().

Counter<double> Actuators::Broom::Task::m_wdog
Counter<double> Actuators::Broom::Task::m_wdog_setup

Setup watchdog.

Referenced by setup().

Collaboration diagram for Actuators::Broom::Task:
Collaboration graph