Drone will not leave initial armed mode


#1

I am currently copying the drone dojo python script for a simple takeoff and land function. The drone follows through on the program and becomes armed. However, the motors only spin at the rotation of the basic, throttle down, spin. There is no acceleration and the drone does not actually take off. I am able to use an rc controller to move my drone, so I know the motors work and can achieve takeoff. Any ideas as to why it would no longer work? Or why it does not adjust the speed whatsoever? Here is the cod ejust in case.

####Dependencies###################

from dronekit import connect, VehicleMode, LocationGlobalRelative
import time
import socket
import exceptions
import argparse

###Function definitions for mission####

##Function to connect script to drone
def connectMyCopter():
    parser = argparse.ArgumentParser(description='commands')
    parser.add_argument('--connect')
    args = parser.parse_args()

    connection_string = args.connect

    vehicle = connect(connection_string, wait_ready=True)

    return vehicle

##Function to arm the drone and takeoff into the air##
def arm_and_takeoff(aTargetAltitude):
   # while not vehicle.is_armable:
   #    print("Waiting for vehicle to become armable")
    #    time.sleep(1)

    #Switch vehicle to GUIDED mode and wait for change
    vehicle.mode = VehicleMode("GUIDED_NOGPS")
    while vehicle.mode!="GUIDED_NOGPS":
        print("Waiting for vehicle to enter GUIDED mode")
        time.sleep(1)

    #Arm vehicle once GUIDED mode is confirmed
    vehicle.armed=True
    while vehicle.armed==False:
        print("Waiting for vehicle to become armed.")
        time.sleep(1)

    vehicle.simple_takeoff(aTargetAltitude)

    while True:
        print("Current Altitude: %d"%vehicle.location.global_relative_frame.alt)
        if vehicle.location.global_relative_frame.alt>=aTargetAltitude*.95:
            break
        time.sleep(1)

    print("Target altitude reached")
    return None

#### Mission################################

vehicle=connectMyCopter()
print("About to takeoff..")

vehicle.mode=VehicleMode("GUIDED_NOGPS")
arm_and_takeoff(2) ##Tell drone to fly 2 meters in the sky
vehicle.mode=VehicleMode("LAND") ##Once drone reaches altitude, tell it to land

time.sleep(2)

print("End of function")
print("Arducopter version: %s"%vehicle.version)

while True: 
    time.sleep(2)

vehicle.close()
### End of script


#2

Just curious, this section is intended to be commented ?

#while not vehicle.is_armable:
#    print("Waiting for vehicle to become armable")
#    time.sleep(1)

#3

Was this ever fixed?? Having the same problem…


#4

Hi there @Jarrod

Couple questions:

Are you using a pixhawk or navio drone?
What version of arducopter are you using?
What version of Dronekit and pymavlink are you using?

It is possible there is a version inconsistency. Are you able to fly the drone around manually like the OP?