RoboidControl-cpp/Things/DifferentialDrive.h
Pascal Serrarens 990100e0ae Diff.Drive Ant
2025-03-04 14:51:39 +01:00

30 lines
771 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 radius of a wheel in meters
float wheelRadius = 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