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

References reset().

void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::DesiredHeading *  msg)
inline

References m_desired_yaw.

void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::DesiredSpeed *  msg)
inline

References m_desired_speed, and m_speed_units.

void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::ControlLoops *  msg)
inline

References m_scope_ref, and reset().

void Control::ASV::HeadingAndSpeed::Task::consume ( const IMC::Rpm *  msg)
inline

References m_rpm, and m_rpm_eid.

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, m_act, m_args, m_last_act, and DUNE::Math::trimValue().

Referenced by consume().

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 m_args, m_desired_speed, m_mps_pid, m_parcel_mps, m_previous_rpm, 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.

Referenced by consume().

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

References reset().

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

Reset PIDs and actuation references.

References m_act, m_last_act, m_mps_pid, m_previous_rpm, m_rpm_pid, and m_yaw_pid.

Referenced by consume(), onResourceInitialization(), and onUpdateParameters().

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 m_args, m_parcel_rpm, m_rpm_pid, Control::ASV::HeadingAndSpeed::Arguments::rpm_eos, Control::ASV::HeadingAndSpeed::Arguments::rpm_ffgain, and Control::ASV::HeadingAndSpeed::Arguments::rpm_hardware.

Referenced by consume().

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

Distribute actuation references if over-saturated.

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

Referenced by consume().

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 m_args, m_common, and Control::ASV::HeadingAndSpeed::Arguments::yaw_max.

Referenced by consume().

Member Data Documentation

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

Current motor actuation.

Referenced by consume(), dispatchThrust(), reset(), and shareSaturation().

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

Apply common actuation.

Referenced by thrustForward().

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

Time of last estimated state message.

Referenced by consume().

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

Desired speed.

Referenced by consume(), mpsToRpm(), and Task().

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

Desired heading.

Referenced by consume().

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

Last motor actuation.

Referenced by dispatchThrust(), and reset().

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

MPS PID controller.

Referenced by mpsToRpm(), reset(), and setup().

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

Control Parcels for meters per second controller.

Referenced by mpsToRpm(), onEntityReservation(), and setup().

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

Control Parcels for rpm controller.

Referenced by onEntityReservation(), rpmToThrust(), and setup().

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

Control Parcels for yaw controller.

Referenced by onEntityReservation(), and setup().

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

previous value of the desired rpm speed

Referenced by consume(), mpsToRpm(), and reset().

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

Motor rpm.

Referenced by consume().

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

Motor rpm entity id.

Referenced by consume(), and onEntityResolution().

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

RPM PID controller.

Referenced by reset(), rpmToThrust(), and setup().

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

Control loops last reference.

Referenced by consume().

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

Desired speed units.

Referenced by consume(), and Task().

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

YAW PID controller.

Referenced by consume(), reset(), and setup().

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