Roboid Control for C++
Loading...
Searching...
No Matches
DifferentialDrive.h
1#pragma once
2
3#include "Thing.h"
4
5namespace RoboidControl {
6
10class DifferentialDrive : public Thing {
11 public:
18 DifferentialDrive(Participant* participant, unsigned char thingId = 0);
23 DifferentialDrive(Thing* parent, unsigned char thingId = 0);
24
32 void SetDriveDimensions(float wheelDiameter, float wheelSeparation);
37
43 void SetWheelVelocity(float speedLeft, float speedRight);
44
46 virtual void Update(unsigned long currentMs, bool recursive = true) override;
47
48 protected:
50 float wheelRadius = 1.0f;
52 float wheelSeparation = 1.0f;
53
55 float rpsToMs = 1.0f;
56
58 Thing* leftWheel = nullptr;
60 Thing* rightWheel = nullptr;
61};
62
63} // namespace RoboidControl
A thing which can move itself using a differential drive system.
Definition DifferentialDrive.h:10
DifferentialDrive()
Create a differential drive without networking support.
Definition DifferentialDrive.cpp:5
Thing * rightWheel
The right wheel.
Definition DifferentialDrive.h:60
float rpsToMs
Convert revolutions per second to meters per second.
Definition DifferentialDrive.h:55
virtual void Update(unsigned long currentMs, bool recursive=true) override
Definition DifferentialDrive.cpp:47
void SetMotors(Thing *leftWheel, Thing *rightWheel)
Congures the motors for the wheels.
Definition DifferentialDrive.cpp:27
float wheelRadius
The radius of a wheel in meters.
Definition DifferentialDrive.h:50
void SetWheelVelocity(float speedLeft, float speedRight)
Directly specify the speeds of the motors.
Definition DifferentialDrive.cpp:39
Thing * leftWheel
The left wheel.
Definition DifferentialDrive.h:58
float wheelSeparation
The distance between the wheels in meters.
Definition DifferentialDrive.h:52
void SetDriveDimensions(float wheelDiameter, float wheelSeparation)
Configures the dimensions of the drive.
Definition DifferentialDrive.cpp:12
A participant is a device which manages things. It can communicate with other participant to synchron...
Definition Participant.h:52
A thing is the primitive building block.
Definition Thing.h:20