コード例 #1
0
  public void forcedGuidedCoordinate(
      final LatLong coord, final double alt, final ICommandListener listener) {
    final Gps droneGps = (Gps) myDrone.getAttribute(AttributeType.GPS);
    if (!droneGps.has3DLock()) {
      postErrorEvent(handler, listener, CommandExecutionError.COMMAND_FAILED);
      return;
    }

    if (isInitialized()) {
      changeCoord(coord);
      changeAlt(alt);
      postSuccessEvent(handler, listener);
    } else {
      mPostInitializationTask =
          new Runnable() {
            @Override
            public void run() {
              changeCoord(coord);
              changeAlt(alt);
            }
          };

      changeToGuidedMode(myDrone, listener);
    }
  }
コード例 #2
0
  public static CameraProxy getCameraProxy(MavLinkDrone drone, List<CameraDetail> cameraDetails) {
    final CameraDetail camDetail;
    final FootPrint currentFieldOfView;
    final List<FootPrint> proxyPrints = new ArrayList<>();

    if (drone == null) {
      camDetail = new CameraDetail();
      currentFieldOfView = new FootPrint();
    } else {
      Camera droneCamera = drone.getCamera();

      camDetail = ProxyUtils.getCameraDetail(droneCamera.getCamera());

      List<Footprint> footprints = droneCamera.getFootprints();
      for (Footprint footprint : footprints) {
        proxyPrints.add(CommonApiUtils.getProxyCameraFootPrint(footprint));
      }

      Gps droneGps = (Gps) drone.getAttribute(AttributeType.GPS);
      currentFieldOfView =
          droneGps != null && droneGps.isValid()
              ? CommonApiUtils.getProxyCameraFootPrint(droneCamera.getCurrentFieldOfView())
              : new FootPrint();
    }

    return new CameraProxy(camDetail, currentFieldOfView, proxyPrints, cameraDetails);
  }
コード例 #3
0
 private static LatLong getGpsPosition(Drone drone) {
   final Gps droneGps = (Gps) drone.getAttribute(AttributeType.GPS);
   return droneGps == null ? null : droneGps.getPosition();
 }