DUNE: Uniform Navigational Environment  2019.02.1
Control::ASV::HeadingAndSpeed::Task Struct Reference

Public Member Functions

 Task (const std::string &name, Tasks::Context &ctx)
 
void onUpdateParameters (void)
 
void onEntityReservation (void)
 
void onEntityResolution (void)
 
void onActivation (void)
 
void onDeactivation (void)
 
void reset (void)
 
void setup (void)
 
void onResourceInitialization (void)
 
void consume (const IMC::Abort *msg)
 
void consume (const IMC::EstimatedState *msg)
 
void consume (const IMC::DesiredHeading *msg)
 
void consume (const IMC::DesiredSpeed *msg)
 
void consume (const IMC::ControlLoops *msg)
 
void consume (const IMC::Rpm *msg)
 
float rpmToThrust (float rpm, float desired_rpm, double timestep)
 
float mpsToRpm (float vel, double timestep)
 
void dispatchThrust (float value, double timestep, uint8_t id)
 
bool thrustForward (float yaw_err)
 
void shareSaturation (void)
 
void onMain (void)
 

Public Attributes

DiscretePID m_rpm_pid
 
DiscretePID m_mps_pid
 
DiscretePID m_yaw_pid
 
IMC::ControlParcel m_parcel_mps
 
IMC::ControlParcel m_parcel_rpm
 
IMC::ControlParcel m_parcel_yaw
 
float m_desired_yaw
 
float m_desired_speed
 
uint8_t m_speed_units
 
Delta m_delta
 
IMC::SetThrusterActuation m_act [2]
 
IMC::SetThrusterActuation m_last_act [2]
 
IMC::Rpm m_rpm [2]
 
float m_previous_rpm
 
bool m_common
 
uint16_t m_rpm_eid [2]
 
uint32_t m_scope_ref
 
Arguments m_args
 

Constructor & Destructor Documentation

Member Function Documentation

void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::Abort *  msg)
inline
void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::EstimatedState *  msg)
inline
void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::DesiredHeading *  msg)
inline
void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::DesiredSpeed *  msg)
inline
void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::ControlLoops *  msg)
inline
void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::Rpm *  msg)
inline
void Control::ASV::HeadingAndSpeed::Task::dispatchThrust ( float  value,
double  timestep,
uint8_t  id 
)
inline

Dispatch to bus SetThrusterActuation message.

Parameters
[in]valueset thrust actuation value
[in]timestepamount of time since last control step

References Control::ASV::HeadingAndSpeed::Arguments::act_max, Control::ASV::HeadingAndSpeed::Arguments::act_ramp, and DUNE::Math::trimValue().

float Control::ASV::HeadingAndSpeed::Task::mpsToRpm ( float  vel,
double  timestep 
)
inline

Convert meters per second to a desired rpm value.

Parameters
[in]velabsolute ground velocity.
[in]timestepamount of time since last control step.
Returns
desired rpm value.

References Control::ASV::HeadingAndSpeed::Arguments::max_accel, Control::ASV::HeadingAndSpeed::Arguments::max_rpm, Control::ASV::HeadingAndSpeed::Arguments::min_rpm, and Control::ASV::HeadingAndSpeed::Arguments::mps_ffgain.

void Control::ASV::HeadingAndSpeed::Task::onActivation ( void  )
inline

On activation.

void Control::ASV::HeadingAndSpeed::Task::onDeactivation ( void  )
inline

On deactivation.

void Control::ASV::HeadingAndSpeed::Task::onEntityReservation ( void  )
inline
void Control::ASV::HeadingAndSpeed::Task::onEntityResolution ( void  )
inline
void Control::ASV::HeadingAndSpeed::Task::onMain ( void  )
inline
void Control::ASV::HeadingAndSpeed::Task::onResourceInitialization ( void  )
inline
void Control::ASV::HeadingAndSpeed::Task::reset ( void  )
inline

Reset PIDs and actuation references.

float Control::ASV::HeadingAndSpeed::Task::rpmToThrust ( float  rpm,
float  desired_rpm,
double  timestep 
)
inline

Convert rpm value to thrust actuation.

Parameters
[in]rpmvalue of rpms currently in the motor
[in]desired_rpmdesired rpms for the motor
[in]timestepamount of time since last control step
Returns
common thrust actuation.

References Control::ASV::HeadingAndSpeed::Arguments::rpm_eos, Control::ASV::HeadingAndSpeed::Arguments::rpm_ffgain, and Control::ASV::HeadingAndSpeed::Arguments::rpm_hardware.

void Control::ASV::HeadingAndSpeed::Task::shareSaturation ( void  )
inline

Distribute actuation references if over-saturated.

References Control::ASV::HeadingAndSpeed::Arguments::act_max, and Control::ASV::HeadingAndSpeed::Arguments::share.

bool Control::ASV::HeadingAndSpeed::Task::thrustForward ( float  yaw_err)
inline

Check if we are facing our waypoint to thrust.

Parameters
[in]yaw_erryaw error.
Returns
true to thrust forward, false otherwise.

References Control::ASV::HeadingAndSpeed::Arguments::yaw_max.

Member Data Documentation

IMC::SetThrusterActuation Control::ASV::HeadingAndSpeed::Task::m_act[2]

Current motor actuation.

Arguments Control::ASV::HeadingAndSpeed::Task::m_args

Task arguments.

bool Control::ASV::HeadingAndSpeed::Task::m_common

Apply common actuation.

Delta Control::ASV::HeadingAndSpeed::Task::m_delta

Time of last estimated state message.

float Control::ASV::HeadingAndSpeed::Task::m_desired_speed

Desired speed.

float Control::ASV::HeadingAndSpeed::Task::m_desired_yaw

Desired heading.

IMC::SetThrusterActuation Control::ASV::HeadingAndSpeed::Task::m_last_act[2]

Last motor actuation.

DiscretePID Control::ASV::HeadingAndSpeed::Task::m_mps_pid

MPS PID controller.

IMC::ControlParcel Control::ASV::HeadingAndSpeed::Task::m_parcel_mps

Control Parcels for meters per second controller.

IMC::ControlParcel Control::ASV::HeadingAndSpeed::Task::m_parcel_rpm

Control Parcels for rpm controller.

IMC::ControlParcel Control::ASV::HeadingAndSpeed::Task::m_parcel_yaw

Control Parcels for yaw controller.

float Control::ASV::HeadingAndSpeed::Task::m_previous_rpm

previous value of the desired rpm speed

IMC::Rpm Control::ASV::HeadingAndSpeed::Task::m_rpm[2]

Motor rpm.

uint16_t Control::ASV::HeadingAndSpeed::Task::m_rpm_eid[2]

Motor rpm entity id.

DiscretePID Control::ASV::HeadingAndSpeed::Task::m_rpm_pid

RPM PID controller.

uint32_t Control::ASV::HeadingAndSpeed::Task::m_scope_ref

Control loops last reference.

uint8_t Control::ASV::HeadingAndSpeed::Task::m_speed_units

Desired speed units.

DiscretePID Control::ASV::HeadingAndSpeed::Task::m_yaw_pid

YAW PID controller.

Collaboration diagram for Control::ASV::HeadingAndSpeed::Task:
Collaboration graph