| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Pierre Allard, |
| * Regent L'Archeveque - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| package org.eclipse.apogy.examples.lidar.impl; |
| |
| import org.eclipse.apogy.common.geometry.data3d.CartesianCoordinatesSet; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| public class LidarStubCustomImpl extends LidarStubImpl { |
| |
| private static final Logger Logger = LoggerFactory.getLogger(LidarStubImpl.class); |
| |
| /** |
| * This is the degree symbol, as expressed in unicode |
| */ |
| private static final String DEGREE_SYM = "\u00b0"; |
| |
| /* |
| * This operation is used to perform the steps necessary to initialize the |
| * Lidar unit. |
| * |
| * @return Whether or not the Lidar's initialization was successfully |
| * completed |
| */ |
| @Override |
| public boolean init() { |
| // As this is a stub, just indicate that the Lidar |
| // unit would have been initialized |
| Logger.info("Just a stub - the necessary initialization for the Lidar unit would have taken place."); |
| |
| // Just return true |
| return true; |
| } |
| |
| /* |
| * This operation is used to acquire a depth scan of the field of view, with |
| * the given horizontal and vertical resolution. <p> Note: This method |
| * operates synchronously and will block until the entire scan has been |
| * completed. |
| * |
| * @param horizontalResolution The horizontal angular resolution of the scan |
| * (in radians.) |
| * |
| * @param verticalResolution The vertical angular resolution of the scan (in |
| * radians.) |
| * |
| * @return The resulting scan with the given horizontal and vertical angular |
| * resolution. |
| * |
| * @see #acquireScanNonBlocking(double, double) |
| */ |
| @Override |
| public CartesianCoordinatesSet acquireScan(double horizontalResolution, double verticalResolution) { |
| // As this is a stub, just indicate that the Lidar |
| // unit would have synchronously taken a depth scan. |
| Logger.info("acquireScan(" + Math.toDegrees(horizontalResolution) + DEGREE_SYM + ", " |
| + Math.toDegrees(verticalResolution) + DEGREE_SYM + "): Just a stub - " |
| + "the Lidar unit would have synchronously taken a depth " |
| + "scan of the Lidar's field of view at the specified resolutions."); |
| |
| // Just return null |
| return null; |
| } |
| |
| /* |
| * This operation is used to acquire a depth scan of the field of view, with |
| * the given horizontal and vertical resolution. <p> Note: This method |
| * operates asynchronously and as such, will return immediately, even if the |
| * scan is not yet completed. |
| * |
| * @param horizontalResolution The horizontal angular resolution of the scan |
| * (in radians.) |
| * |
| * @param verticalResolution The vertical angular resolution of the scan (in |
| * radians.) |
| * |
| * @return The resulting scan with the given horizontal and vertical angular |
| * resolution. |
| * |
| * @see #acquireScan(double, double) |
| */ |
| @Override |
| public CartesianCoordinatesSet acquireScanNonBlocking(double horizontalResolution, double verticalResolution) { |
| // As this is a stub, just indicate that the Lidar |
| // unit would have synchronously taken a depth scan. |
| Logger.info("acquireScanNonBlocking(" + Math.toDegrees(horizontalResolution) + DEGREE_SYM + ", " |
| + Math.toDegrees(verticalResolution) + DEGREE_SYM + "): Just a stub - " |
| + "the Lidar unit would have asynchronously taken a depth " |
| + "scan of the Lidar's field of view at the specified resolutions."); |
| |
| // Just return null |
| return null; |
| } |
| } // LidarStubImpl |