-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.js
executable file
·91 lines (37 loc) · 1.41 KB
/
code.js
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
var df = require('dateformat')
, autonomy = require('ardrone-autonomy')
, mission = autonomy.createMission()
, arDrone = require('ar-drone')
, arDroneConstants = require('ar-drone/lib/constants')
;
function navdata_option_mask(c) {
return 1 << c;
}
// From the SDK.
var navdata_options = (
navdata_option_mask(arDroneConstants.options.DEMO)
| navdata_option_mask(arDroneConstants.options.VISION_DETECT)
| navdata_option_mask(arDroneConstants.options.MAGNETO)
| navdata_option_mask(arDroneConstants.options.WIFI)
);
// Connect and configure the drone
mission.client().config('general:navdata_demo', true);
mission.client().config('general:navdata_options', navdata_options);
mission.client().config('video:video_channel', 1);
mission.client().config('detect:detect_type', 12);
mission.client().config('control:flight_without_shell', false);
mission.log("mission-" + df(new Date(), "yyyy-mm-dd_hh-MM-ss") + ".txt");
mission.takeoff()
.go({x:0, y:0, z:2.0})
.hover(40000)
.land();
mission.run(function (err, result) {
if (err) {
console.trace("Oops, something bad happened: %s", err.message);
mission.client().stop();
mission.client().land();
} else {
console.log("We are done!");
process.exit(0);
}
});