-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainGoToWaypoint.cpp
47 lines (34 loc) · 934 Bytes
/
mainGoToWaypoint.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
/*
* File: mainGoToWaypoint.cpp
* Author: Jan Dufek
*
* Created on October 16, 2018, 7:52 PM
*/
#include <stdio.h>
#include "Fotokite.hpp"
/**
*
*/
int main(int argc, char *argv[]) {
// Check if the program has 9 arguments
if (argc != 10) {
return -1;
}
// Initialize Fotokite interface for OCU server
Fotokite * fotokite = new Fotokite("/tmp/cmds", "127.0.0.1", 8080);
// Initialize waypoint
double waypoint[9];
// Parse the waypoint from the program argument
for (int i = 1; i < argc; i++) {
// Convert string to double
if (sscanf(argv[i], "%lg", & waypoint[i - 1]) != 1) {
return i;
}
}
// Go to waypoint
fotokite->goToWaypoint(waypoint);
// Delete Fotokite object (important for stopping remote control mode on Fotokite)
delete fotokite;
// Clean exit
return 0;
}