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

Member Function Documentation

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

Sanitize the actuation reference (limits and sign)

Parameters
[in]valueactuation reference value to be sanitized

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

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

Set phase current value as actuation reference.

Parameters
[in]valuephase current reference in Ampere

References Actuators::Broom::Arguments::ctl_iadc_max, Actuators::Broom::MODE_CURRENT, and DUNE::Math::trimValue().

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

Set percentage of duty cycle as actuation reference.

Parameters
[in]valuepercentage reference from -1.0 to 1.0

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

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

Set rotor Rotations Per Minute value as actuation reference.

Parameters
[in]valuerotor angular velocity reference in Rotations Per Minute

References Actuators::Broom::MODE_RPM, and Actuators::Broom::Arguments::pole_pairs.

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

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

Parameters
[in]valuepercentage of thrust from -1 to 1

References Actuators::Broom::Arguments::ctl_iadc_max, Actuators::Broom::Arguments::max_rpm, Actuators::Broom::MODE_CURRENT, Actuators::Broom::MODE_NONE, Actuators::Broom::MODE_RPM, and Actuators::Broom::MODE_VOLTAGE.

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

Member Data Documentation

int16_t Actuators::Broom::Task::m_actuation

Actuation command.

Arguments Actuators::Broom::Task::m_args

Task arguments.

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

Used to silence some spurious boot errors.

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

Bridge entity.

DevControlModes Actuators::Broom::Task::m_ctl_mode

Control mode.

uint8_t Actuators::Broom::Task::m_dev_errors

Device error mask.

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

EEPROM - General Config Area.

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

EEPROM - DCYC Config Area.

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

EEPROM - RPM Config Area.

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

EEPROM - IADC Config Area.

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

Entity state timer.

size_t Actuators::Broom::Task::m_faults_count

Faults count.

bool Actuators::Broom::Task::m_legacy

Enable legacy protocol.

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

MCU entity.

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

Motor entity.

unsigned Actuators::Broom::Task::m_motor_id

Motor identifier.

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

Device protocol handler.

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

RPMs message.

size_t Actuators::Broom::Task::m_sample_count

Sample count.

SetupState Actuators::Broom::Task::m_setup_state

Setup state.

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

State update timer.

DevControlModes Actuators::Broom::Task::m_thrust_ctl_mode

Thrust control mode.

size_t Actuators::Broom::Task::m_timeout_count

Timeout count.

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

Version.

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

Watchdog.

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

Setup watchdog.

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