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
# 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.
4
+
5
+
importasyncio, random
6
+
frommavsdkimportSystem
7
+
8
+
# Test set of manual inputs. Format: [roll, pitch, throttle, yaw]
9
+
manual_inputs= [
10
+
[0, 0, 0.5, 0], # no movement
11
+
[-1, 0, 0.5, 0], # minimum roll
12
+
[1, 0, 0.5, 0], # maximum roll
13
+
[0, -1, 0.5, 0], # minimum pitch
14
+
[0, 1, 0.5, 0], # maximum pitch
15
+
[0, 0, 0.5, -1], # minimum yaw
16
+
[0, 0, 0.5, 1], # maximum yaw
17
+
[0, 0, 1, 0], # max throttle
18
+
[0, 0, 0, 0], # minimum throttle
19
+
]
20
+
21
+
22
+
asyncdefmanual_controls():
23
+
# Connect to the Simulation
24
+
drone=System()
25
+
awaitdrone.connect(system_address="udp://:14540")
26
+
27
+
# This waits till a mavlink based drone is connected
28
+
asyncforstateindrone.core.connection_state():
29
+
ifstate.is_connected:
30
+
print(f"-- Connected to drone with UUID: {state.uuid}")
0 commit comments