I follow the following link's sample code
http://android.dronekit.io/first_app.html
and when I set API VehicleApi.getApi(this.drone).arm(true); vehicleState.isFlying() automatically becomes true.
Can anybody tell me what this problem is?
What I need is: 1. take off, land
I read from some website that the dronekit-android does not support the mode changing. If so, how should I send the mavlink message to take off and land? So far, I can sucessfully send the mavlink message to the PX4 board.
Thanks for replying.
Thank you for replying.
BR SeanH
If you trace though some of the code in dronekit-android, you can see that
isFlying
is set here with the code below.MAV_STATE_ACTIVE, defined here states
So
isFlying
doesn't mean it's airborne but just that the motors are turned on. That occurs when you callVehicleApi.getApi(this.drone).arm(true);
because you are literally arming the vehicle at that point.For takeoff, you want to use the ControlApi.
ControlApi.getApi(drone).takeOff(desired_altitude, listener)
and for land you need to useVehicleApi.getApi(drone).setVehicleMode(VehicleMode.COPTER_LAND, listener)
The sample code you're looking at is very old. I suggest you follow the sample app from github.