dronekit / dronekit-python

DroneKit-Python library for communicating with Drones via MAVLink.
https://readthedocs.org/projects/dronekit-python/
Apache License 2.0
1.59k stars 1.44k forks source link

Cannot arm with Channel Overrides- stuck at Initialising APM #617

Open jainakshay91 opened 8 years ago

jainakshay91 commented 8 years ago

I have been trying to arm my quad with RC Overrides, but I cannot do so as it gets stuck at Initialising APM and then jumps to the next statement in my code. Any ideas regarding this issue?

Arducopter version: 3.3.3 Dronekit-python version: 2.0 OS version: 3.10.80-135 GNU/Linux

Thanks in Advance, Best Akshay

hamishwillee commented 8 years ago

Please create a gist with your code and link to it from here.

jainakshay91 commented 8 years ago

Link to my code

hamishwillee commented 8 years ago

I'd re-write this to run on SITL - makes testing cycle a lot easier. Is there any reason you can't use conventional arming code for the takeoff?:

    print "Basic pre-arm checks"
    # Don't try to arm until autopilot is ready
    while not vehicle.is_armable:
        print " Waiting for vehicle to initialise..."
        time.sleep(1)

    print "Arming motors"
    # Copter should arm in GUIDED mode
    vehicle.mode    = VehicleMode("GUIDED")
    vehicle.armed   = True

    # Confirm vehicle armed before attempting to take off
    while not vehicle.armed:
        print " Waiting for arming..."
        time.sleep(1)

Then up your throttle using RC overrides to actually take off.

jainakshay91 commented 8 years ago

Yeah well I can do that, that was my initial thought. But since I am developing my own RC controller, I wanted to just try and pass the PWMs based on stick positions to get the drone to arm. I will go the conventional way if a solution does not come up.

Any ideas as to what could be causing the arm procedure to halt midway with "Initialising APM.." message.

hamishwillee commented 8 years ago

YOu can't take off without explicitly arming AFAIK. Initialising must complete before you try to arm. Use the code above before your other code :-)

jainakshay91 commented 8 years ago

Yeah I will do that for now. Thanks :)