Path: blob/master/libraries/AC_Autorotation/RSC_Autorotation.h
9638 views
// Class supporting autorotation state within the heli rotor speed controller12#pragma once34#include <AP_Param/AP_Param.h>56// helper class to manage autorotation state and variables within RSC7class RSC_Autorotation8{9public:1011RSC_Autorotation(void);1213enum class State {14DEACTIVATED,15BAILING_OUT,16ACTIVE,17};1819// state accessors20bool active(void) const { return state == State::ACTIVE; }21bool bailing_out(void) const { return state == State::BAILING_OUT; }22bool enabled(void) const { return enable.get() == 1; }2324// update idle throttle when in autorotation25bool get_idle_throttle(float& idle_throttle);2627// get the throttle ramp rate needed when bailing out of autorotation28float get_bailout_ramp(void) const;2930// get the allowed run-up time that we expect the rotor to need to complete a bailout31float get_runup_time(void) const;3233// request changes in autorotation state34void set_active(bool active, bool force_state);3536// sanity check of parameters, should be called only whilst disarmed37bool arming_checks(size_t buflen, char *buffer) const;3839// var_info for holding Parameter information40static const struct AP_Param::GroupInfo var_info[];4142private:4344AP_Int8 idle_output; // (percent) rsc output used when in autorotation, used for setting autorotation window on ESCs45AP_Int8 bailout_throttle_time; // (seconds) time for in-flight power re-engagement when bailing-out of an autorotation46AP_Int8 bailout_runup_time; // (seconds) expected time for the motor to fully engage and for the rotor to regain safe head speed if necessary47AP_Int8 enable; // enables autorotation state within the RSC4849State state;50uint32_t bail_out_started_ms; // (milliseconds) time that bailout started, used to time transition from "bailing out" to "autorotation stopped"5152};535455