0

Is there a way to get the flying state of the drone using dronekit ? and by flying state I mean: Landed, Taking off, hovering, flying, landing

HAOUAS Khaled
  • 40
  • 1
  • 6

1 Answers1

2

Yes, you can get the flying state of the drone for some of the cases you list. Of course this will all depend on how you've programmed your flight behavior with dronekit. Here is what I would do:

  • Hovering: self.vehicle.mode.name == "LOITER"
  • Flying: self.vehicle.mode.name in ("GUIDED","AUTO")
  • Landing: self.vehicle.mode.name == "LAND"
  • Landed: self.vehicle.armed == False (the quadcopter props should automatically disarm once the drone has completed the landing procedure)
  • Taking off: no straightforward answer here but you could infer it from the altitude of your drone. If you've sent a takeoff(target_alt) instruction and the drone has not reached the target_alt then you're probably still taking off.
clem
  • 66
  • 6