Waiting for vehicle to be armable loop


#1

hi,

Im stuck on an issue I have read multiple articles about.

While running the autonomous mission takeoff and land from the drone dojo github
I am stuck in the loop where the script cannot detect I am armed.
While in fact, I am very much armed, to the point that I can even spin the motors with my RC controller.
If I start the motors with RC, script would still say “waiting for vehicle to become armable”.
MP message section doesn’t report any issues.
Im using the Pixhawk drone version.

Some attempts made:
-The manualArm is set to False, tried True as well.
-changed Mission planner Arming_Check to 0.
-tested the older dronekit script from the video, same result.
-tried turn off, turn on the RC transmitter
-armed the drone using the RC transmitter
-checked my script identation
-let the script run for more than 10 minutes

when I break the script, it shows it hangs here:

Full code:
(copy pasting in picture to show identation)




#2

(Edited after reading Steven’s comments. Indeed it hasn’t reached the mode setting yet.)
I assume the RPi is connecting since you are not getting a connection error and reached the arm_and_takeoff function. For common connection issues, see https://dojofordrones.com/ardupilot-connection-issues./.

You might set INS_LOG_BAT_MASK = 1 and share the bin file to look for clues?


#3

I’ve not gotten to this part of the course, however:

vehicle.is_armable is returning False, it is in an infinite while loop.
In this case, I would focus on the vehicle instance and check that you have made a connection. Looking at the drone kit connection documentation /dev/ttyAMA0 implies that you are attempting to connect to the vehicle via Serial port, is your physical connection working? I.e. are the cables plugged in correctly.
https://dronekit-python.readthedocs.io/en/latest/guide/connecting_vehicle.html

On line 19, you have the print statement. You can use this to print something to assist with debugging. I’m not sure if is_armable is strictly a Bool or not. You could try printing vehicle.is_armable and see what you get print("Vehicle armable: " + "vehicle.is_armable"). If that gives you nothing meaningful, try printing vehicle print(vehicle). However, from this code, I think vehicle might be a class object, in which case try print(vars(vehicle)). Print as much as you can about the connection that has been made. Just be wary of this tough, if the vehicle is armed and you call something like vehcile.takeoff() within the print statement, I’m not sure if it would takeoff as I am not familiar with dronekit just yet.


#4

If you are referring to vehicle.mode = VehicleMode("GUIDED") it is not in guided mode. Python is an interpreted language so it has not reached this line of code yet.


#5

I’ve had more time to look into the vehicle attributes, this should help with your debugging. is_armable is the specific attribute that is causing the infinite loop.
https://dronekit.netlify.app/automodule.html#dronekit.Vehicle.is_armable

is_armable ensures that the vehicle has booted, has a good GPS fix, and that the EKF pre-arm is complete.

So we need to check the following:

  • Is the vehicle booted
    print(vehicle.system_status) should provide some boot information
  • does it have a GPS fix
    print(vehicle.gps_0) will give you GPS information
  • EKF pre-arm
    print(vehicle.ekf_ok) will provide the status of EKF as a Bool.

Hope that helps.


#6

This is helpful and good review of what Caleb touched on in the Programming course.

Might add this list of the vehicle attributes in dronekit:
https://dronekit.netlify.app/guide/vehicle_state_and_parameters.html

Enabling the LOG_DISARMED setting might help with a diagnosis.


#7

guys, these comments were very helpful.

sorry about the delay, have been going through the programming course because I didn’t know how to sitl yet.

I am able to run the program by retyping most the code from the video instead of the github,

my returns from Steven’s commands are standby, 3, true

vehicle.system_status
STANDBY: System is grounded and on standby. It can be launched any tim

vehicle.system_status
fix_type 3: 3D fix

vehicle.ekf_ok
True if the EKF status is considered acceptable

wonder if something is up with my GPS?
I have calibrated the drone couple times,
I noticed that when I connect telemetry to Mission planner, the virtual drone is drifting (up and down meters and left right a little bit) while the real drone is in the floor.

I think Im good for now and will proceed to fix my gps error,
read some other posts saying that I should be outside, so maybe thats my issue (Im in my room)
Prearm: Need 3D Fix in guided mode - Course Questions / Drone Programming - Drone Dojo (dojofordrones.com)

thank you for all the help!!

-Ricardo