Skip to content

Commit

Permalink
fixed servo javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Mar 7, 2024
1 parent be8dbbb commit 49dc3e5
Showing 1 changed file with 14 additions and 45 deletions.
59 changes: 14 additions & 45 deletions src/main/java/org/myrobotlab/service/Servo.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/**
*
* @author GroG (at) myrobotlab.org
*
* This file is part of MyRobotLab (http://myrobotlab.org).
*
* MyRobotLab is free software: you can redistribute it and/or modify
* it under the terms of the Apache License 2.0 as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version (subject to the "Classpath" exception
* as provided in the LICENSE.txt file that accompanied this code).
*
* MyRobotLab is distributed in the hope that it will be useful or fun,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Apache License 2.0 for more details.
*
* All libraries in thirdParty bundle are subject to their own license
* requirements - please refer to http://myrobotlab.org/libraries for
* details.
*
* Enjoy !
*
* */

package org.myrobotlab.service;

import java.util.Set;
Expand All @@ -35,32 +10,27 @@
import org.myrobotlab.service.config.ServiceConfig;
import org.myrobotlab.service.config.ServoConfig;
import org.myrobotlab.service.data.ServoMove;
import org.myrobotlab.service.interfaces.ServiceLifeCycleListener;
import org.slf4j.Logger;

/**
* @author GroG
* Servos have both input and output. Input is usually of the range of integers
* between 0.0 - 180.0, and output can relay those values directly to the
* servo's firmware (Arduino ServoLib, I2C controller, etc)
*
* Servos have both input and output. Input is usually of the range of
* integers between 0.0 - 180.0, and output can relay those values
* directly to the servo's firmware (Arduino ServoLib, I2C controller,
* etc)
* However there can be the occasion that the input comes from a system which
* does not have the same range. Such that input can vary from 0.0 to 1.0. For
* example, OpenCV coordinates are often returned in this range. When a mapping
* is needed Servo.map can be used. For this mapping Servo.map(0.0, 1.0, 0, 180)
* might be desired. Reversing input would be done with Servo.map(180, 0, 0,
* 180)
*
* However there can be the occasion that the input comes from a system
* which does not have the same range. Such that input can vary from 0.0
* to 1.0. For example, OpenCV coordinates are often returned in this
* range. When a mapping is needed Servo.map can be used. For this
* mapping Servo.map(0.0, 1.0, 0, 180) might be desired. Reversing input
* would be done with Servo.map(180, 0, 0, 180)
* outputY - is the values sent to the firmware, and should not necessarily be
* confused with the inputX which is the input values sent to the servo
*
* outputY - is the values sent to the firmware, and should not
* necessarily be confused with the inputX which is the input values
* sent to the servo
*
* FIXME - inherit from AbstractMotor ..
* FIXME - inherit from AbstractMotor ..
*
* @author GroG
*/

public class Servo extends AbstractServo<ServoConfig> {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -92,7 +62,7 @@ protected boolean processMove(Double newPos, boolean blocking, Long timeoutMs) {
double maxLimit = Math.max(mapper.minX, mapper.maxX);
newPos = (newPos < minLimit) ? minLimit : newPos;
newPos = (newPos > maxLimit) ? maxLimit : newPos;

log.debug("{} processMove {}", getName(), newPos);

// This is to allow attaching disabled
Expand Down Expand Up @@ -259,7 +229,6 @@ public static void main(String[] args) throws InterruptedException {
return;
}


} catch (Exception e) {
log.error("main threw", e);
}
Expand Down

0 comments on commit 49dc3e5

Please sign in to comment.