Taking off using dronekit and PX4

I'm using an Intel Aero RTF drone with PX4 and I want to test a simple take off of this drone but the script I followed didn't give me results it just arms the dron and disarms but never takes off This is the script:

#! /usr/bin/python  
from dronekit import connect, VehicleMode, LocationGlobalRelative  
import time  

vehicle = connect('tcp:127.0.0.1:5760', wait_ready=False)  
def arm_and_takeoff(aTarget):  
         ### I commented this lines because the code doesn't pass from 
    this loop ###       
         #print 'Pre arm-checks'  
         #while not vehicle.is_armable:  
         #     print "Initializing...'  
         #     time.sleep(1)  
         print 'Arming motors'  
         vehicle.mode = VehicleMode("GUIDED")  
         vehicle.armed = True  
         while not vehicle.armed:  
              print "waiting for arming"  
              time.sleep(1)  
         print "Take Off!"  
         vehicle.simpe_takeoff(aTarget)  
         while True:  
              print "Altitude: ",vehicle.location.global_relative_frame.alt  
              if vehicle.location.global_relative_frame.alt >= aTarget * 0.95:  
                   print "Altitude target reached"  
                   break  
              time.sleep(1)  
    arm_and_takeoff(10)  
    print "Take off complete!"  
    time.sleep(10)  
    print "Landing"  
    vehicle.mode = VehicleMode("LAND") 

As I said it just arms for a few seconds and the disarms, what am I doing wrong?? Regards

Upvotes: 1

Views: 1059

Answers (1)

Baskara
Baskara

Reputation: 301

Dronekit doesn't officially support PX4 flight stack, you should Dronecode SDK for PX4 (https://sdk.dronecode.org/en/) or change your fligh stack to ArduPilot, but there is a limited support for PX4 too you can read about it here https://dev.px4.io/en/robotics/dronekit.html.

Upvotes: 1

Related Questions