Пример #1
0
  public static Mission getMission(MavLinkDrone drone) {
    Mission proxyMission = new Mission();
    if (drone == null) return proxyMission;

    org.droidplanner.services.android.core.mission.Mission droneMission = drone.getMission();
    List<org.droidplanner.services.android.core.mission.MissionItem> droneMissionItems =
        droneMission.getComponentItems();

    proxyMission.setCurrentMissionItem((short) drone.getMissionStats().getCurrentWP());
    if (!droneMissionItems.isEmpty()) {
      for (org.droidplanner.services.android.core.mission.MissionItem item : droneMissionItems) {
        proxyMission.addMissionItem(ProxyUtils.getProxyMissionItem(item));
      }
    }

    return proxyMission;
  }
Пример #2
0
  public static void setMission(MavLinkDrone drone, Mission mission, boolean pushToDrone) {
    if (drone == null) return;

    org.droidplanner.services.android.core.mission.Mission droneMission = drone.getMission();
    droneMission.clearMissionItems();

    List<MissionItem> itemsList = mission.getMissionItems();
    for (MissionItem item : itemsList) {
      droneMission.addMissionItem(ProxyUtils.getMissionItemImpl(droneMission, item));
    }

    if (pushToDrone) droneMission.sendMissionToAPM();
  }