Line data Source code
1 : #pragma once 2 : 3 : #include "AC_CustomControl_config.h" 4 : 5 : #if AP_COPTER_CUSTOMCONTROL_ENABLED 6 : 7 : #include "AC_CustomControl.h" 8 : 9 : class AC_CustomControl_Backend 10 : { 11 : public: 12 2 : AC_CustomControl_Backend(AC_CustomControl& frontend, AP_AHRS_View*& ahrs, AC_AttitudeControl*& att_control, AP_MotorsMulticopter*& motors, float dt) : 13 2 : _ahrs(ahrs), 14 2 : _att_control(att_control), 15 2 : _motors(motors), 16 2 : _frontend(frontend) 17 2 : {} 18 : 19 : // empty destructor to suppress compiler warning 20 0 : virtual ~AC_CustomControl_Backend() {} 21 : 22 : // update controller, return roll, pitch, yaw controller output 23 : virtual Vector3f update() = 0; 24 : 25 : // reset controller to avoid build up or abrupt response upon switch, ex: integrator, filter 26 : virtual void reset() = 0; 27 : 28 : // set the PID notch sample rates 29 0 : virtual void set_notch_sample_rate(float sample_rate) {}; 30 : 31 : protected: 32 : // References to external libraries 33 : AP_AHRS_View*& _ahrs; 34 : AC_AttitudeControl*& _att_control; 35 : AP_MotorsMulticopter*& _motors; 36 : AC_CustomControl& _frontend; 37 : }; 38 : 39 : #endif // AP_COPTER_CUSTOMCONTROL_ENABLED