33 lines
855 B
C++
33 lines
855 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();
|
|
DifferentialDrive(Participant* participant);
|
|
|
|
void SetDimensions(float wheelDiameter, float wheelSeparation);
|
|
void SetMotors(Thing* leftWheel, Thing* rightWheel);
|
|
|
|
void SetWheelVelocity(float speedLeft, float speedRight);
|
|
|
|
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
|