root / mikrokopter / src / nav_lib.cpp @ 493cca7c
History | View | Annotate | Download (721 Bytes)
1 |
#include "nav_lib.h" |
---|---|
2 |
|
3 |
|
4 |
void init_control_msg(mikrokopter::Control& req)
|
5 |
{ |
6 |
req.digital[0] = 0; |
7 |
req.digital[1] = 0; |
8 |
req.remoteKey = 0;
|
9 |
req.pitch = 0;
|
10 |
req.roll = 0;
|
11 |
req.yaw = 0;
|
12 |
req.thrust = 40;
|
13 |
req.height = 0;
|
14 |
req.free = 0;
|
15 |
req.frame = 7;
|
16 |
req.config = 1;
|
17 |
} |
18 |
|
19 |
void forward(mikrokopter::Control& req)
|
20 |
{ |
21 |
req.roll = -15;
|
22 |
req.pitch = -15;
|
23 |
} |
24 |
|
25 |
void backward(mikrokopter::Control& req)
|
26 |
{ |
27 |
req.roll = 15;
|
28 |
req.pitch = 15;
|
29 |
} |
30 |
|
31 |
void left(mikrokopter::Control& req)
|
32 |
{ |
33 |
req.roll = -15;
|
34 |
req.pitch = 15;
|
35 |
} |
36 |
|
37 |
void right(mikrokopter::Control& req)
|
38 |
{ |
39 |
req.roll = 15;
|
40 |
req.pitch = -15;
|
41 |
} |
42 |
|
43 |
void set_thrust(mikrokopter::Control& req, int thrust) |
44 |
{ |
45 |
req.thrust = thrust; |
46 |
} |
47 |
|