| /******************************************************************************* |
| * 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.lander.impl; |
| |
| import org.eclipse.apogy.examples.lander.LanderLegExtension; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| public class LanderStubCustomImpl extends LanderStubImpl { |
| |
| private static final Logger Logger = LoggerFactory.getLogger(LanderStubImpl.class); |
| |
| // FIXME Should be centralized. |
| |
| /** |
| * This is the degree symbol, as expressed in unicode |
| */ |
| private static final String DEGREE_SYM = "\u00b0"; |
| |
| @Override |
| public double getGravitationalPull() { |
| // Determine how much gravitational pull is subjected to the lander |
| return 0; |
| } |
| |
| @Override |
| public double getMass() { |
| // Just return the mass |
| return 1; |
| } |
| |
| @Override |
| public boolean init() { |
| // As this is a stub, just indicate that the lander would |
| // have been initialized |
| Logger.info("Just a stub: The necessary initialization for the lander would have taken place."); |
| |
| // Just return true |
| return true; |
| } |
| |
| @Override |
| public void commandLegPosition(LanderLegExtension legAExtension, LanderLegExtension legBExtension, |
| LanderLegExtension legCExtension) { |
| // As this is a stub, just indicate that the legs of the lander |
| // would have extended / retracted as commanded. |
| Logger.info(".commandLegPosition(LanderLegPosition." + legAExtension.getName() + ", LanderLegPosition." |
| + legBExtension.getName() + ", LanderLegPosition." + legCExtension.getName() + "): Just a stub - " |
| + "the legs of the lander would have extended / " + "retracted to match the specified leg extensions"); |
| } |
| |
| @Override |
| public void commandAngularVelocities(double xAngularVelocity, double yAngularVelocity) { |
| // As this is a stub, just indicate that the lander's |
| // angular velocities would have been updated. |
| Logger.info(".commandAngularVelocities(" + Math.toDegrees(xAngularVelocity) + " (" + DEGREE_SYM + "/s), " |
| + Math.toDegrees(yAngularVelocity) + " (" + DEGREE_SYM + "/s)): Just a stub - " |
| + "the lander's angular velocities would have been " + "appropriately updated."); |
| } |
| |
| @Override |
| public void commandThrust(double thrustLevel) { |
| // As this is a stub, just indicate that the lander's |
| // thrust would have been updated. |
| Logger.info(".commandThrust(" + thrustLevel + "): Just a stub - " + "the lander's thrust level would have been " |
| + "appropriately updated."); |
| } |
| |
| @Override |
| public void changeThrustBy(double thrustOffset) { |
| // As this is a stub, just indicate that the lander's |
| // thrust would have been updated. |
| Logger.info(".changeThrustBy(" + thrustOffset + "): Just a stub - " |
| + "the lander's thrust level would have been " + "increased / decreased accordingly."); |
| } |
| |
| @Override |
| public void startFlying(boolean logStateChanges) { |
| // As this is a stub, just indicate that the lander |
| // could now start flying |
| Logger.info( |
| ".startFlying(" + logStateChanges + "): Just a stub - " + "the lander would be able to start flying."); |
| } |
| |
| @Override |
| public void stopFlying() { |
| // As this is a stub, just indicate that the lander |
| // can no longer fly and should land |
| Logger.info("Just a stub - " + "the lander would stop flying and land immediately."); |
| } |
| |
| @Override |
| public void moveTo(double x, double y, double z) { |
| // As this is a stub, just indicate that the lander |
| // should move to the coordinates specified. |
| Logger.info("moveTo(" + x + ", " + y + ", " + z + "): " + "Just a stub - the lander would move to the " |
| + "specified Cartesian coordinates."); |
| } |
| |
| @Override |
| public void changeAttitude(double xAngle, double yAngle, double zAngle) { |
| // As this is a stub, just indicate that the lander |
| // should change its attitude / orientation to the specified angles |
| Logger.info("changeAttitude(" + Math.toDegrees(xAngle) + DEGREE_SYM + ", " + Math.toDegrees(yAngle) + DEGREE_SYM |
| + ", " + Math.toDegrees(zAngle) + DEGREE_SYM + "): Just a stub - " |
| + "the lander would change its attitude / orientation " + "to reflect the specified angles."); |
| } |
| |
| @Override |
| public void resetAttitude() { |
| // As this is a stub, just indicate that the lander |
| // should reset its attitude / orientation |
| Logger.info("resetAttitude(): Just a stub - " + "the lander would reset its attitude / orientation."); |
| } |
| |
| @Override |
| public void dispose() { |
| // As this is a stub, just indicate that the lander |
| // should perform the required disposal operations |
| Logger.info("dispose(): Just a stub - " + "the lander would perform the required " + "disposal operations."); |
| } |
| } // LanderStubImpl |