Line data Source code
1 : /// @file AP_MotorsTailsitter.h 2 : /// @brief Motor control class for tailsitters and bicopters 3 : #pragma once 4 : 5 : #include <AP_Common/AP_Common.h> 6 : #include <AP_Math/AP_Math.h> 7 : #include "AP_MotorsMulticopter.h" 8 : 9 : /// @class AP_MotorsTailsitter 10 : class AP_MotorsTailsitter : public AP_MotorsMulticopter { 11 : public: 12 : 13 : /// Constructor 14 : AP_MotorsTailsitter(uint16_t speed_hz = AP_MOTORS_SPEED_DEFAULT); 15 : 16 : // init 17 : void init(motor_frame_class frame_class, motor_frame_type frame_type) override; 18 : 19 : // set frame class (i.e. quad, hexa, heli) and type (i.e. x, plus) 20 0 : void set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type) override {} 21 : 22 : // set update rate to motors - a value in hertz 23 : void set_update_rate( uint16_t speed_hz ) override; 24 : 25 : // output_to_motors - sends output to named servos 26 : void output_to_motors() override; 27 : 28 : // get_motor_mask - returns a bitmask of which outputs are being used for motors or servos (1 means being used) 29 : // this can be used to ensure other pwm outputs (i.e. for servos) do not conflict 30 : uint32_t get_motor_mask() override; 31 : 32 : // output_motor_mask is not supported by the tailsitter backend, override to ensure no action. 33 12096 : void output_motor_mask(float thrust, uint32_t mask, float rudder_dt) override {}; 34 : 35 : // Set by tailsitters using diskloading minumum outflow velocity limit 36 18764 : void set_min_throttle(float val) {_external_min_throttle = val;} 37 : 38 : protected: 39 : // calculate motor outputs 40 : void output_armed_stabilizing() override; 41 : 42 2 : const char* _get_frame_string() const override { return "TAILSITTER"; } 43 : 44 : // spin a motor at the pwm value specified 45 : void _output_test_seq(uint8_t motor_seq, int16_t pwm) override; 46 : 47 : // calculated outputs 48 : float _throttle; // 0..1 49 : float _tilt_left; // -1..1 50 : float _tilt_right; // -1..1 51 : float _thrust_left; // 0..1 52 : float _thrust_right; // 0..1 53 : 54 : // Set by tailsitters using diskloading minumum outflow velocity limit 55 : float _external_min_throttle; 56 : 57 : // true if differential thrust is available 58 : bool _has_diff_thrust; 59 : 60 : };