Smartcar Shield
Loading...
Searching...
No Matches
DifferentialControl.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include "../../motor/Motor.hpp"
9#include "../Control.hpp"
10
12{
13public:
26 DifferentialControl(Motor& leftMotor, Motor& rightMotor);
27
28 /* Check `Control` interface for documentation */
29 void setAngle(int angle) override;
30
31 /* Check `Control` interface for documentation */
32 void setSpeed(int speed) override;
33
34 /* Check `Control` interface for documentation */
35 void overrideMotorSpeed(int firstMotorSpeed, int secondMotorSpeed) override;
36
37private:
38 void setMotors();
39 Motor& mLeftMotor;
40 Motor& mRightMotor;
41 int mAngle{ 0 };
42 int mSpeed{ 0 };
43};
Interface to generalize all classes that can provide a way to control a Car.
Definition Control.hpp:24
Class to represent controling a vehicle by applying different speed on each side, like a tank.
void overrideMotorSpeed(int firstMotorSpeed, int secondMotorSpeed) override
Set the motor speed individually as a percentage of the motors` total power.
void setSpeed(int speed) override
Sets the driving speed as percentage of the total motor speed where the sign represents the direction...
void setAngle(int angle) override
Sets the driving angle in degrees [-90, 90].
Interface programmatically representing any kind of motor.
Definition Motor.hpp:23