From 611104f63c4a6b73cfebdabda1a43b5184fed020 Mon Sep 17 00:00:00 2001 From: Federico Mandelli <federico.mandelli@skywarder.eu> Date: Wed, 30 Nov 2022 15:52:04 +0000 Subject: [PATCH] [Servo] Fixed getPosition method with correct angle values --- src/shared/actuators/Servo/Servo.cpp | 4 ++-- src/shared/actuators/Servo/Servo.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shared/actuators/Servo/Servo.cpp b/src/shared/actuators/Servo/Servo.cpp index 2cabb2505..3cf442736 100644 --- a/src/shared/actuators/Servo/Servo.cpp +++ b/src/shared/actuators/Servo/Servo.cpp @@ -103,9 +103,9 @@ float Servo::getPosition() float Servo::getPosition90Deg() { return getPosition() * 90; } -float Servo::getPosition180Deg() { return getPosition() * 1800; } +float Servo::getPosition180Deg() { return getPosition() * 180; } -float Servo::getPosition360Deg() { return getPosition() * 3600; } +float Servo::getPosition360Deg() { return getPosition() * 360; } ServoData Servo::getState() { diff --git a/src/shared/actuators/Servo/Servo.h b/src/shared/actuators/Servo/Servo.h index e4a792cc1..537520489 100644 --- a/src/shared/actuators/Servo/Servo.h +++ b/src/shared/actuators/Servo/Servo.h @@ -53,7 +53,7 @@ namespace Boardcore * Note that the peripheral clock of the undelying timer used to generate the * PWM signal, is enabled when the object is created and disabled when * destructed. When using the same timer for two or more sensors keep in mind - * that you could encouter issues. + * that you could encounter issues. */ class Servo { -- GitLab