You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/manual_control.py
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,17 @@
1
1
#! /usr/bin/env python3
2
2
3
-
# This example shows how to use the manual controls plugin. Manual inputs are taken from a test set, but the use of a joystick can be implemented using third party extensions.
3
+
"""
4
+
This example shows how to use the manual controls plugin.
4
5
5
-
importasyncio, random
6
+
Note: Manual inputs are taken from a test set in this example to decrease complexity. Manual inputs
7
+
can be received from devices such as a joystick using third-party python extensions
8
+
9
+
Note: Taking off the drone is not necessary before enabling manual inputs. It is acceptable to send
10
+
positive throttle input to leave the ground. Takeoff is used in this example to decrease complexity
11
+
"""
12
+
13
+
importasyncio
14
+
importrandom
6
15
frommavsdkimportSystem
7
16
8
17
# Test set of manual inputs. Format: [roll, pitch, throttle, yaw]
@@ -20,6 +29,7 @@
20
29
21
30
22
31
asyncdefmanual_controls():
32
+
"""Main function to connect to the drone and input manual controls"""
23
33
# Connect to the Simulation
24
34
drone=System()
25
35
awaitdrone.connect(system_address="udp://:14540")
@@ -45,7 +55,7 @@ async def manual_controls():
45
55
print("-- Arming")
46
56
awaitdrone.action.arm()
47
57
48
-
# Takeoff the vehicle (Not a necessary command, but makes it easier to see manual controls working)
0 commit comments