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/Blimp/Loiter.h
Views: 1798
1
#pragma once
2
3
class Vector4b
4
{
5
public:
6
bool x;
7
bool y;
8
bool z;
9
bool yaw;
10
11
constexpr Vector4b()
12
: x(0)
13
, y(0)
14
, z(0)
15
, yaw(0) {}
16
17
constexpr Vector4b(const bool x0, const bool y0, const bool z0, const bool yaw0)
18
: x(x0)
19
, y(y0)
20
, z(z0)
21
, yaw(yaw0) {}
22
23
Vector4b operator &&(const Vector4b &v)
24
{
25
Vector4b temp{x && v.x, y && v.y, z && v.z, yaw && v.yaw};
26
return temp;
27
}
28
29
Vector4b operator ||(const Vector4b &v)
30
{
31
Vector4b temp{x || v.x, y || v.y, z || v.z, yaw || v.yaw};
32
return temp;
33
}
34
35
};
36
37
38
39
class Loiter
40
{
41
public:
42
friend class Blimp;
43
friend class Fins;
44
45
float scaler_xz;
46
float scaler_yyaw;
47
48
//constructor
49
Loiter(uint16_t loop_rate)
50
{
51
scaler_xz = 1;
52
scaler_yyaw = 1;
53
};
54
55
//Run Loiter controller with target position and yaw in global frame. Expects to be called at loop rate.
56
void run(Vector3f& target_pos, float& target_yaw, Vector4b axes_disabled);
57
//Run Loiter controller with target velocity and velocity in global frame. Expects to be called at loop rate.
58
void run_vel(Vector3f& target_vel, float& target_vel_yaw, Vector4b axes_disabled);
59
};
60
61