Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AC_Autorotation/RSC_Autorotation.h
9638 views
1
// Class supporting autorotation state within the heli rotor speed controller
2
3
#pragma once
4
5
#include <AP_Param/AP_Param.h>
6
7
// helper class to manage autorotation state and variables within RSC
8
class RSC_Autorotation
9
{
10
public:
11
12
RSC_Autorotation(void);
13
14
enum class State {
15
DEACTIVATED,
16
BAILING_OUT,
17
ACTIVE,
18
};
19
20
// state accessors
21
bool active(void) const { return state == State::ACTIVE; }
22
bool bailing_out(void) const { return state == State::BAILING_OUT; }
23
bool enabled(void) const { return enable.get() == 1; }
24
25
// update idle throttle when in autorotation
26
bool get_idle_throttle(float& idle_throttle);
27
28
// get the throttle ramp rate needed when bailing out of autorotation
29
float get_bailout_ramp(void) const;
30
31
// get the allowed run-up time that we expect the rotor to need to complete a bailout
32
float get_runup_time(void) const;
33
34
// request changes in autorotation state
35
void set_active(bool active, bool force_state);
36
37
// sanity check of parameters, should be called only whilst disarmed
38
bool arming_checks(size_t buflen, char *buffer) const;
39
40
// var_info for holding Parameter information
41
static const struct AP_Param::GroupInfo var_info[];
42
43
private:
44
45
AP_Int8 idle_output; // (percent) rsc output used when in autorotation, used for setting autorotation window on ESCs
46
AP_Int8 bailout_throttle_time; // (seconds) time for in-flight power re-engagement when bailing-out of an autorotation
47
AP_Int8 bailout_runup_time; // (seconds) expected time for the motor to fully engage and for the rotor to regain safe head speed if necessary
48
AP_Int8 enable; // enables autorotation state within the RSC
49
50
State state;
51
uint32_t bail_out_started_ms; // (milliseconds) time that bailout started, used to time transition from "bailing out" to "autorotation stopped"
52
53
};
54
55