Hello World
This code will arm and the disarm the motor after 5 seconds:
To execute this code is:
python armmotor.py
Explaining the code:
#!/usr/bin/python
from dronekit import connect, VehicleMode, LocationGlobalRelative
import time
vehicle = connect('tcp:127.0.0.1:5760', wait_ready=False)
print "Arming motors:"
vehicle.mode = VehicleMode("GUIDED")
vehicle.armed = True
while not vehicle.armed:
print " Waiting for arming to be finished"
time.sleep(1)
print "Keeping motors armed for 5s"
time.sleep(5)
print "Disarming"
vehicle.armed = False
Last updated
Was this helpful?