-
Notifications
You must be signed in to change notification settings - Fork 1
/
Example.py
66 lines (51 loc) · 2.38 KB
/
Example.py
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
from Swarm import Swarm
import time
import logging
# Configure a logging level
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
swarm = Swarm()
init_time = time.time()
swarm.start_mission([0, 1])
# Test of sending commands
# You can comment this block
for i in range(500):
swarm.simultaneous_control_egalitarian_actions([0, 1], "speed?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "battery?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "time?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "height?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "temp?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "attitude?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "baro?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "acceleration?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "tof?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "wifi?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "sdk?")
swarm.simultaneous_control_egalitarian_actions([0, 1], "sn?")
# Example
swarm.simultaneous_control_egalitarian_actions([0, 1], "speed 50")
swarm.simultaneous_control_egalitarian_actions([0, 1], "takeoff")
# Example 1
for _ in range(2):
for _ in range(2):
swarm.simultaneous_control_different_actions([0, 1], ["up 50", "forward 50"])
swarm.simultaneous_control_different_actions([0, 1], ["down 50", "back 50"])
swarm.simultaneous_control_egalitarian_actions([0, 1], "cw 180")
for _ in range(2):
swarm.simultaneous_control_different_actions([0, 1], ["up 50", "forward 50"])
swarm.simultaneous_control_different_actions([0, 1], ["down 50", "back 50"])
swarm.simultaneous_control_egalitarian_actions([0, 1], "cw 180")
# Example 2
swarm.simultaneous_control_egalitarian_actions([0, 1], "up 50")
swarm.simultaneous_control_different_actions([0, 1], ["up 50", "down 50"])
action1 = "down 100"
action2 = "up 100"
for _ in range(2):
swarm.simultaneous_control_different_actions([0, 1], [action1, action2])
aux = action1
action1 = action2
action2 = aux
swarm.simultaneous_control_different_actions([0, 1], ["down 50", "up 50"])
swarm.simultaneous_control_egalitarian_actions([0, 1], "land")
swarm.end_mission()
final_time = time.time() - init_time
logging.debug("The time elapsed is: %s " % final_time)