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