CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AC_CustomControl/AC_CustomControl_Backend.h
Views: 1798
1
#pragma once
2
3
#include "AC_CustomControl_config.h"
4
5
#if AP_CUSTOMCONTROL_ENABLED
6
7
#include "AC_CustomControl.h"
8
9
class AC_CustomControl_Backend
10
{
11
public:
12
AC_CustomControl_Backend(AC_CustomControl& frontend, AP_AHRS_View*& ahrs, AC_AttitudeControl*& att_control, AP_MotorsMulticopter*& motors, float dt) :
13
_ahrs(ahrs),
14
_att_control(att_control),
15
_motors(motors),
16
_frontend(frontend)
17
{}
18
19
// empty destructor to suppress compiler warning
20
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
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_CUSTOMCONTROL_ENABLED
40
41