Xiaomin
  • Xioamin
  • Unnamed Aerial Vehicle
    • Intel Drone Aero
    • Hybrid
  • SetUp
    • Operating Systems
      • Ubuntu 16.04
        • Upgrade Debian 8 to Debian 9
        • Installing OpenCV 3.3.0 on Ubuntu 16.04 LTS
      • Raspbian
        • Installing OpenCV 3.3.0 on Raspbian
      • Yocto
  • Solutions
    • DroneKit
      • Installation
      • Script
        • Hello World
        • Simple Goto
    • Image Processing
      • Real-time object detect
      • Object Tracking
      • Face detection
    • Autonomous Drone Solution
    • Collision Avoidance
Powered by GitBook
On this page

Was this helpful?

  1. Solutions
  2. DroneKit
  3. Script

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
PreviousScriptNextSimple Goto

Last updated 5 years ago

Was this helpful?