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_AttitudeControl/AC_WeatherVane.h
Views: 1798
1
#include <AP_Param/AP_Param.h>
2
3
// weather vane class
4
class AC_WeatherVane {
5
public:
6
7
// Constructor
8
AC_WeatherVane(void);
9
10
CLASS_NO_COPY(AC_WeatherVane);
11
12
// Calculate and return the yaw output to weathervane the vehicle
13
bool get_yaw_out(float &yaw_output, const int16_t pilot_yaw, const float hgt, const float roll_cdeg, const float pitch_cdeg, const bool is_takeoff, const bool is_landing);
14
15
// Function to reset all flags and set values. Invoked whenever the weather vaning process is interrupted
16
void reset(void);
17
18
// allow/disallow weather vaning from other means than by the parameter
19
void allow_weathervaning(bool allow) { allowed = allow; }
20
21
static const struct AP_Param::GroupInfo var_info[];
22
23
private:
24
25
// Different options for the direction that vehicle will turn into wind
26
enum class Direction {
27
TAKEOFF_OR_LAND_ONLY = -1,
28
OFF = 0,
29
NOSE_IN = 1, // Only nose into wind
30
NOSE_OR_TAIL_IN = 2, // Nose in or tail into wind, which ever is closest
31
SIDE_IN = 3, // Side into wind for copter tailsitters
32
TAIL_IN = 4, // backwards, for tailsitters, makes it easier to descend
33
};
34
35
enum class Options {
36
PITCH_ENABLE = (1<<0),
37
};
38
39
// Parameters
40
AP_Int8 _direction;
41
AP_Float _gain;
42
AP_Float _min_dz_ang_deg;
43
AP_Float _min_height;
44
AP_Float _max_vel_xy;
45
AP_Float _max_vel_z;
46
AP_Int8 _landing_direction;
47
AP_Int8 _takeoff_direction;
48
AP_Int16 _options;
49
50
float last_output;
51
bool active_msg_sent;
52
uint32_t first_activate_ms;
53
uint32_t last_check_ms;
54
55
// Init to true here to avoid a race between init of RC_channel and weathervane
56
bool allowed = true;
57
};
58
59