From bed54033ce77102e392be922c097c1294c3a092d Mon Sep 17 00:00:00 2001 From: grog Date: Wed, 6 Mar 2024 07:50:41 -0800 Subject: [PATCH 1/3] rothead starts auto --- .../java/org/myrobotlab/service/config/InMoov2HeadConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/myrobotlab/service/config/InMoov2HeadConfig.java b/src/main/java/org/myrobotlab/service/config/InMoov2HeadConfig.java index 9d46a4d19b..c9c89ab013 100644 --- a/src/main/java/org/myrobotlab/service/config/InMoov2HeadConfig.java +++ b/src/main/java/org/myrobotlab/service/config/InMoov2HeadConfig.java @@ -33,7 +33,6 @@ public Plan getDefault(Plan plan, String name) { addDefaultPeerConfig(plan, name, "forheadLeft", "Servo", false); addDefaultPeerConfig(plan, name, "eyelidLeftUpper", "Servo", false); addDefaultPeerConfig(plan, name, "eyelidLeftLower", "Servo", false); - addDefaultPeerConfig(plan, name, "rothead", "Servo", false); addDefaultPeerConfig(plan, name, "upperLip", "Servo", false); addDefaultPeerConfig(plan, name, "eyeLeftLR", "Servo", false); From be8dbbb0c7dd6b5537b1fdedc33924bfa8dfb754 Mon Sep 17 00:00:00 2001 From: grog Date: Wed, 6 Mar 2024 15:54:15 -0800 Subject: [PATCH 2/3] isEnabled in Random --- src/main/java/org/myrobotlab/service/Random.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/myrobotlab/service/Random.java b/src/main/java/org/myrobotlab/service/Random.java index d018df206a..ed601f9044 100644 --- a/src/main/java/org/myrobotlab/service/Random.java +++ b/src/main/java/org/myrobotlab/service/Random.java @@ -140,6 +140,14 @@ public void addRandom(long minIntervalMs, long maxIntervalMs, String name, Strin public void addRandom(long minIntervalMs, long maxIntervalMs, String name, String method) { addRandom(minIntervalMs, maxIntervalMs, name, method, toRanges((Object[]) null)); } + + /** + * Global check for enabled + * @return + */ + public boolean isEnabled() { + return enabled; + } public Range intRange(int min, int max) { return new Range(min, max); From 49dc3e5f3110e06a7993ffdf927a3b83f081e17e Mon Sep 17 00:00:00 2001 From: grog Date: Wed, 6 Mar 2024 16:11:24 -0800 Subject: [PATCH 3/3] fixed servo javadoc --- .../java/org/myrobotlab/service/Servo.java | 59 +++++-------------- 1 file changed, 14 insertions(+), 45 deletions(-) diff --git a/src/main/java/org/myrobotlab/service/Servo.java b/src/main/java/org/myrobotlab/service/Servo.java index 7b59121998..cbd2d62627 100644 --- a/src/main/java/org/myrobotlab/service/Servo.java +++ b/src/main/java/org/myrobotlab/service/Servo.java @@ -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; @@ -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 { private static final long serialVersionUID = 1L; @@ -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 @@ -259,7 +229,6 @@ public static void main(String[] args) throws InterruptedException { return; } - } catch (Exception e) { log.error("main threw", e); }