|
|
|
@ -71,17 +71,18 @@ public:
@@ -71,17 +71,18 @@ public:
|
|
|
|
|
static AP_Motors *get_singleton(void) { return _singleton; } |
|
|
|
|
|
|
|
|
|
// check initialisation succeeded
|
|
|
|
|
bool initialised_ok() const { return _flags.initialised_ok; } |
|
|
|
|
bool initialised_ok() const { return _initialised_ok; } |
|
|
|
|
void set_initialised_ok(bool val) { _initialised_ok = val; } |
|
|
|
|
|
|
|
|
|
// arm, disarm or check status status of motors
|
|
|
|
|
bool armed() const { return _flags.armed; } |
|
|
|
|
bool armed() const { return _armed; } |
|
|
|
|
void armed(bool arm); |
|
|
|
|
|
|
|
|
|
// set motor interlock status
|
|
|
|
|
void set_interlock(bool set) { _flags.interlock = set;} |
|
|
|
|
void set_interlock(bool set) { _interlock = set;} |
|
|
|
|
|
|
|
|
|
// get motor interlock status. true means motors run, false motors don't run
|
|
|
|
|
bool get_interlock() const { return _flags.interlock; } |
|
|
|
|
bool get_interlock() const { return _interlock; } |
|
|
|
|
|
|
|
|
|
// set_roll, set_pitch, set_yaw, set_throttle
|
|
|
|
|
void set_roll(float roll_in) { _roll_in = roll_in; }; // range -1 ~ +1
|
|
|
|
@ -198,7 +199,7 @@ public:
@@ -198,7 +199,7 @@ public:
|
|
|
|
|
PWM_TYPE_DSHOT600 = 6, |
|
|
|
|
PWM_TYPE_DSHOT1200 = 7}; |
|
|
|
|
pwm_type get_pwm_type(void) const { return (pwm_type)_pwm_type.get(); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
// output functions that should be overloaded by child classes
|
|
|
|
|
virtual void output_armed_stabilizing() = 0; |
|
|
|
@ -216,13 +217,6 @@ protected:
@@ -216,13 +217,6 @@ protected:
|
|
|
|
|
// save parameters as part of disarming
|
|
|
|
|
virtual void save_params_on_disarm() {} |
|
|
|
|
|
|
|
|
|
// flag bitmask
|
|
|
|
|
struct AP_Motors_flags { |
|
|
|
|
uint8_t armed : 1; // 0 if disarmed, 1 if armed
|
|
|
|
|
uint8_t interlock : 1; // 1 if the motor interlock is enabled (i.e. motors run), 0 if disabled (motors don't run)
|
|
|
|
|
uint8_t initialised_ok : 1; // 1 if initialisation was successful
|
|
|
|
|
} _flags; |
|
|
|
|
|
|
|
|
|
// internal variables
|
|
|
|
|
uint16_t _loop_rate; // rate in Hz at which output() function is called (normally 400hz)
|
|
|
|
|
uint16_t _speed_hz; // speed in hz to send updates to motors
|
|
|
|
@ -261,7 +255,13 @@ protected:
@@ -261,7 +255,13 @@ protected:
|
|
|
|
|
float _thrust_boost_ratio; // choice between highest and second highest motor output for output mixing (0 ~ 1). Zero is normal operation
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
|
|
|
|
bool _armed; // 0 if disarmed, 1 if armed
|
|
|
|
|
bool _interlock; // 1 if the motor interlock is enabled (i.e. motors run), 0 if disabled (motors don't run)
|
|
|
|
|
bool _initialised_ok; // 1 if initialisation was successful
|
|
|
|
|
|
|
|
|
|
static AP_Motors *_singleton; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
namespace AP { |
|
|
|
|