From 6ce9d78b0462f0639e16e0cb9ad34a6f3d71be67 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Thu, 4 Jan 2024 17:10:29 +0100 Subject: [PATCH] Servos and Controlled motor updates --- ControlledMotor.h | 4 ++-- FeedbackServo.h | 16 ++++++++++++++++ Servo.h | 11 +++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 FeedbackServo.h diff --git a/ControlledMotor.h b/ControlledMotor.h index 3c3d1e9..a522b7b 100644 --- a/ControlledMotor.h +++ b/ControlledMotor.h @@ -27,11 +27,11 @@ public: /// @brief Set the target speed for the motor controller /// @param speed the target in revolutions per second. - void SetTargetSpeed(float speed); + virtual void SetTargetSpeed(float speed); /// @brief Get the actual speed from the encoder /// @return The speed in revolutions per second - float GetActualSpeed(); + virtual float GetActualSpeed(); bool Drive(float distance); diff --git a/FeedbackServo.h b/FeedbackServo.h new file mode 100644 index 0000000..6d2085e --- /dev/null +++ b/FeedbackServo.h @@ -0,0 +1,16 @@ +#pragma once + +#include "Servo.h" + +namespace Passer { +namespace RoboidContol { + +class FeedbackServo : public Servo { +public: + FeedbackServo(); + + virtual float GetActualAngle() = 0; +}; + +} // namespace RoboidContol +} // namespace Passer \ No newline at end of file diff --git a/Servo.h b/Servo.h index 27f9bca..27cd9e3 100644 --- a/Servo.h +++ b/Servo.h @@ -2,9 +2,16 @@ #include "ControlledMotor.h" -class Servo : public ControlledMotor { +namespace Passer { +namespace RoboidContol { + +class Servo : public Thing { public: Servo(); virtual void SetTargetAngle(float angle) = 0; -}; \ No newline at end of file +}; + +} // namespace RoboidContol +} // namespace Passer +using namespace Passer::RoboidContol; \ No newline at end of file