-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
130 lines (103 loc) · 4.76 KB
/
main.cpp
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* File: main.cpp
* Author: Jan Dufek
*
* Created on April 26, 2017, 6:39 PM
*/
#include "Fotokite.hpp"
/**
* This main function contains example usage of the library.
*/
int main(int argc, char *argv[]) {
// Initialize Fotokite interface for OCU server
// Fotokite * fotokite = new Fotokite("127.0.0.1", 8080, 8080);
// Initialize Fotokite interface for USB serial interface
Fotokite * fotokite = new Fotokite(SERIAL_PORT);
// fotokite->takeoff();
// Execute path
// fotokite->executePath("input/velocity_control_test.txt");
fotokite->executePath();
// fotokite->land();
// fotokite->stopMotors();
// sleep(5);
// fotokite->takeoff();
// fotokite->land();
// Go to waypoint
// fotokite->goToWaypoint(0, 1, 0, 10, 1, 0, 0, 0, 0);
// Elevation angle tether arc correction experiment. For each point the first
// trial is with the uncorrected elevation angle and the second trial is with
// the corrected elevation angle for tether arc. All the points are on the
// diagonal going from the origin at -45° angle from x-axis. They vary in
// distance from the origin and high. Since they are on the diagonal, x and
// z coordinates will be the same for a single waypoint.
// Flight altitude 0.5 m
// fotokite->goToWaypoint(0.5 / sqrt(2), 0.5, 0.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1 / sqrt(2), 0.5, 1 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1.5 / sqrt(2), 0.5, 1.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2 / sqrt(2), 0.5, 2 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2.5 / sqrt(2), 0.5, 2.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(3 / sqrt(2), 0.5, 3 / sqrt(2), 0, 0, 0, 0, 0, 0);
// Flight altitude 1 m
// fotokite->goToWaypoint(0.5 / sqrt(2), 1, 0.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1 / sqrt(2), 1, 1 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1.5 / sqrt(2), 1, 1.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2 / sqrt(2), 1, 2 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2.5 / sqrt(2), 1, 2.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(3 / sqrt(2), 1, 3 / sqrt(2), 0, 0, 0, 0, 0, 0);
// Flight altitude 1.5 m
// fotokite->goToWaypoint(0.5 / sqrt(2), 1.5, 0.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1 / sqrt(2), 1.5, 1 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1.5 / sqrt(2), 1.5, 1.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2 / sqrt(2), 1.5, 2 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2.5 / sqrt(2), 1.5, 2.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(3 / sqrt(2), 1.5, 3 / sqrt(2), 0, 0, 0, 0, 0, 0);
// Flight altitude 2 m (first one and then reverse order because of motion capture height limitation)
// fotokite->goToWaypoint(0.5 / sqrt(2), 2, 0.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(3 / sqrt(2), 2, 3 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2.5 / sqrt(2), 2, 2.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(2 / sqrt(2), 2, 2 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1.5 / sqrt(2), 2, 1.5 / sqrt(2), 0, 0, 0, 0, 0, 0);
// fotokite->goToWaypoint(1 / sqrt(2), 2, 1 / sqrt(2), 0, 0, 0, 0, 0, 0);
// Print state
// while (true) {
// fotokite->printState();
// }
// Print attitude
// while (true) {
// cout << "!Attitude " + to_string(fotokite->getQX()) + "," + to_string(fotokite->getQY()) + "," + to_string(fotokite->getQZ()) + "," + to_string(fotokite->getQW()) << endl;
// }
// Ground status message
// fotokite->getGroundMode();
// fotokite->getRuntimeS();
// fotokite->getGroundBattVoltage();
// fotokite->getRelTetherLength();
// Attitude message
// fotokite->getQX();
// fotokite->getQY();
// fotokite->getQZ();
// fotokite->getQW();
// Position message
// fotokite->getElevation();
// fotokite->getRelAzimuth();
// fotokite->getBaroAlt();
// Flight status message
// fotokite->getFlightMode();
// fotokite->getOnTime();
// fotokite->getBackup();
// fotokite->getFlags();
// Gimbal
// fotokite->gimbal(0.30, 0.1);
// fotokite->gimbalRoll(0.29);
// fotokite->gimbalPitch(0.30);
// Position
// fotokite->pos(-0.25, -0.2, -77836.8758);
// fotokite->posV(0.25);
// fotokite->posH(0.200000);
// fotokite->posL(0);
// Yaw
// fotokite->yaw(-0.1);
// Delete Fotokite object (important for stopping remote control mode on Fotokite)
delete fotokite;
// Clean exit
return 0;
}