I'm trying to create simple mission using Drone-Kit android.
Mission myMission = new Mission();
myMission.clear();
Takeoff to = new Takeoff();
ReturnToLaunch rtl = new ReturnToLaunch();
//set Altitude in meters
rtl.setReturnAltitude(2);
to.setTakeoffAltitude(2);
myMission.addMissionItem(to);
myMission.addMissionItem(rtl);
MissionApi.getApi(this.drone).setMission(myMission,true);
The problem is that sometimes it works, and sometimes it's doesn't... I don't know why it not working... I'm not getting any errors in the code.
I'm listening to the
AttributeEvent.MISSION_UPDATED
AttributeEvent.MISSION_SENT
AttributeEvent.MISSION_RECEIVED
but only the AttributeEvent.MISSION_UPDATED
is fired when I run the code.
And even if its fired, this doesn't mean that the mission updated correctly.
I'm checking the mission with Mission Planer.
I just don't understand why it is working sometimes and sometimes not.
I did make sure that the drone connected to the app. Also I made sure that the drone is OK and arm-able. I really stuck here... and any help will be appreciated.
I will answer my question, in case someone have the same problem.
I have contacted the developers, and it seems that I'm not the only one who have this BUG. It seems that when you add
ReturnToLaunch
toMission
something happening in the API and the mission is not sent to the drone. As soon as I removedReturnToLaunch
object from theMission
all worked properly.Work-Around: To overcome the issue, I am putting the drone in
RTL
mode, when theMission
is done.