I want to simulate a simple VTOL maneuver in Mission Planner SITL. I am able to arm the pixhawk 6x and also to make it take off and go to waypoints inside mission planner SITL.
Now I have a python script, which performs a simple VTOL maneuver:
import time as t
import dronekit as dk
from dronekit import VehicleMode
TCP_FC_TARGET = "tcp:127.0.0.1:5762"
def PrintOptions():
print("*** VTOL TEST ***")
print("OPTIONS:")
print("[t] TAKE-OFF")
print(" <alt> ALTITUDE")
print("[v] VTOL (VERTICAL TAKE OFF AND LANDING)")
print(" <alt> ALTITUDE")
print("[l] LAND")
def VTOL(tcp_addr, altitude):
vehicle = dk.connect(tcp_addr, wait_ready=True)
vehicle.mode = VehicleMode("GUIDED")
vehicle.armed = True
while not vehicle.armed:
print("[AQ_STAT] DRONE ARMING")
t.sleep(1)
print(f"[AQ_STAT] DRONE TAKING OFF TO TARGET ALTITUDE [{altitude}] m")
vehicle.simple_takeoff(altitude)
while True:
print(f"[AQ_STAT] LIVE ALTITUDE: [{vehicle.location.global_relative_frame.alt}] m")
if vehicle.location.global_relative_frame.alt >= altitude * 0.9:
print("[AQ_STAT] REACHED ALTITUDE, PROCEED TO LAND IN 2 SECONDS")
break
t.sleep(2)
print("[AQ_STAT] LANDING...")
vehicle.mode = VehicleMode("LAND")
vehicle.close()
def main():
PrintOptions()
command = input("AQ/VTOL_TEST>")
if command == "v" or command == "V":
altitude = int(input(" ALT[m]: "))
VTOL(TCP_FC_TARGET, altitude=altitude)
if __name__ == "__main__":
main()
When I run this script, I get following:
CRITICAL:autopilot:APM:Copter V3.3 (d6053245)
CRITICAL:autopilot:Frame: QUAD
[AQ_STAT] DRONE ARMING
ERROR:autopilot:Arm: Mode not armable
[AQ_STAT] DRONE ARMING
[AQ_STAT] DRONE ARMING
[AQ_STAT] DRONE ARMING
[AQ_STAT] DRONE ARMING
It tells me that the drone is not armable in GUIDED mode. Do you know how to fix this? Thanks in advance!