RoboidControl-cpp/Things/DifferentialDrive.h
2025-03-03 17:12:43 +01:00

30 lines
775 B
C++

#pragma once
#include "Thing.h"
namespace RoboidControl {
/// @brief A thing which can move itself using a differential drive system
class DifferentialDrive : public Thing {
public:
DifferentialDrive(Participant* participant);
void SetDimensions(float wheelDiameter, float wheelSeparation);
void SetMotors(Thing* leftWheel, Thing* rightWheel);
virtual void Update(unsigned long currentMs) override;
protected:
/// @brief The diameter of a wheel in meters
float wheelDiameter = 1.0f;
/// @brief The distance between the wheels in meters
float wheelSeparation = 1.0f;
/// @brief Convert revolutions per second to meters per second
float rpsToMs = 1.0f;
Thing* leftWheel = nullptr;
Thing* rightWheel = nullptr;
};
} // namespace RoboidControl