DroneKit mission not sent to drone

早过忘川 提交于 2020-01-07 04:37:05

问题


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.


回答1:


I have not tried dronekit-android before but I think it is better to open an issue here.

The source code for android project has not been updated for more than two years!

In general,there is a protocol to upload/download a mission. It is not easy to implement but you can implement it. I did that in c++. You should always check the acknowledgment from the drone before going in the next step. Check the protocol here.




回答2:


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 to Mission something happening in the API and the mission is not sent to the drone. As soon as I removed ReturnToLaunch object from the Mission all worked properly.

Work-Around: To overcome the issue, I am putting the drone in RTL mode, when the Mission is done.



来源:https://stackoverflow.com/questions/43832575/dronekit-mission-not-sent-to-drone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!