| /******************************************************************************* |
| * 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.robotic_arm.impl; |
| |
| import org.eclipse.apogy.examples.robotic_arm.ApogyExamplesRoboticArmFacade; |
| import org.eclipse.apogy.examples.robotic_arm.MoveSpeedLevel; |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| public class RoboticArmStubCustomImpl extends RoboticArmStubImpl { |
| |
| private static final Logger Logger = LoggerFactory.getLogger(RoboticArmStubImpl.class); |
| |
| /** |
| * This is the degree symbol, as expressed in unicode |
| */ |
| private static final String DEGREE_SYM = "\u00b0"; |
| |
| /** |
| <<<<<<< HEAD |
| * Performs the required operations required in order to initialize the robotic |
| * arm. |
| ======= |
| * Performs the required operations required in order to initialize the |
| * robotic arm. |
| >>>>>>> refs/heads/eclipse_pa |
| * |
| * @return Whether or not the robotic arm was successfully initialized. |
| */ |
| @Override |
| public boolean init() { |
| // As this is a stub, just indicate that the robotic arm would have been |
| // initialized |
| Logger.info("Just a stub: The necessary initialization for the arm would have taken place."); |
| |
| // Set the active Robotic Arm to be this one. |
| ApogyExamplesRoboticArmFacade.INSTANCE.setActiveRoboticArm(this); |
| |
| // Indicate that it was successful |
| return true; |
| } |
| |
| /** |
| * Changes the level of speed at which the robotic arm should move; this is |
| <<<<<<< HEAD |
| * likely to be used by both moveTo() and stow() as they both involve moving the |
| * arm. |
| * |
| * @param speedLevel The new move speed level, indicating how fast the arm |
| * should move. |
| ======= |
| * likely to be used by both moveTo() and stow() as they both involve moving |
| * the arm. |
| * |
| * @param speedLevel |
| * The new move speed level, indicating how fast the arm should |
| * move. |
| >>>>>>> refs/heads/eclipse_pa |
| */ |
| @Override |
| public void cmdMoveSpeedLevel(MoveSpeedLevel speedLevel) { |
| // Indicate that the move speed level would have been changed |
| Logger.info("Set speed level to <" + speedLevel.getLiteral() + ">."); |
| } |
| |
| /** |
| * Initiates the motion of the arm and move the arm to the specified |
| * configuration. |
| * |
| <<<<<<< HEAD |
| * @param turretAngle The expected angle (in radians) of the turret joint |
| * (joint 1) after moving |
| * @param shoulderAngle The expected angle (in radians) of the shoulder joint |
| * (joint 2) after moving. |
| * @param elbowAngle The expected angle (in radians) of the elbow joint |
| * (joint 3) after moving. |
| * @param wristAngle The expected angle (in radians) of the wrist joint |
| * (joint 4) after moving. |
| ======= |
| * @param turretAngle |
| * The expected angle (in radians) of the turret joint (joint 1) |
| * after moving |
| * @param shoulderAngle |
| * The expected angle (in radians) of the shoulder joint (joint |
| * 2) after moving. |
| * @param elbowAngle |
| * The expected angle (in radians) of the elbow joint (joint 3) |
| * after moving. |
| * @param wristAngle |
| * The expected angle (in radians) of the wrist joint (joint 4) |
| * after moving. |
| >>>>>>> refs/heads/eclipse_pa |
| */ |
| @Override |
| public void moveTo(double turretAngle, double shoulderAngle, double elbowAngle, double wristAngle) { |
| // Indicate that the robotic arm would have moved to the given joint |
| // configuration |
| Logger.info("moveTo(" + Math.toDegrees(turretAngle) + DEGREE_SYM + ", " + Math.toDegrees(shoulderAngle) |
| + DEGREE_SYM + ", " + Math.toDegrees(elbowAngle) + DEGREE_SYM + ", " + Math.toDegrees(wristAngle) |
| + DEGREE_SYM + ")."); |
| } |
| |
| @Override |
| /** |
| * Initiates the motion of the arm and moves the arm to the stow |
| * configuration. |
| */ |
| public void stow() { |
| // The robotic arm would have moved to its stow joint configuration |
| Logger.info("The robotic arm would have moved to the stow joint configuration."); |
| } |
| } // RoboticArmStubImpl |