Servos and Controlled motor updates

This commit is contained in:
Pascal Serrarens 2024-01-04 17:10:29 +01:00
parent 0e11b0db5f
commit 6ce9d78b04
3 changed files with 27 additions and 4 deletions

View File

@ -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);

16
FeedbackServo.h Normal file
View File

@ -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

11
Servo.h
View File

@ -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;
};
};
} // namespace RoboidContol
} // namespace Passer
using namespace Passer::RoboidContol;