2023-12-05 12:25:27 +01:00

36 lines
1004 B
C++

#pragma once
#include <time.h>
#include "Thing.h"
namespace Passer {
namespace RoboidControl {
/// @brief A Motor is a Thing which can move parts of the Roboid
/// @note Currently only rotational motors are supported
class Motor : public Thing {
public:
/// @brief Default constructor for the Motor
Motor();
/// @brief Motor turning direction
enum class Direction { Clockwise = 1, CounterClockwise = -1 };
/// @brief The forward turning direction of the motor
Direction direction = Direction::Clockwise;
/// @brief Set the target motor speed
/// @param speed The speed between -1 (full backward), 0 (stop) and 1 (full
/// forward)
virtual void SetSpeed(float speed);
/// @brief Get the current target speed of the motor
/// @return The speed between -1 (full backward), 0 (stop) and 1 (full
/// forward)
virtual float GetSpeed();
protected:
float currentTargetSpeed = 0;
};
} // namespace RoboidControl
} // namespace Passer
using namespace Passer::RoboidControl;