2024-01-09 17:14:33 +01:00

40 lines
1.0 KiB
C++

#pragma once
#include "Thing.h"
#include <time.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 SetTargetSpeed(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 GetActualSpeed();
virtual void Update(float currentTimeMs);
float currentTargetSpeed = 0;
protected:
};
} // namespace RoboidControl
} // namespace Passer
using namespace Passer::RoboidControl;