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); }
private static double getDroneAltConstrained(MavLinkDrone drone) { final Altitude droneAltitude = (Altitude) drone.getAttribute(AttributeType.ALTITUDE); double alt = Math.floor(droneAltitude.getAltitude()); return Math.max(alt, getDefaultMinAltitude(drone)); }