Go to the documentation of this file.
3 #include "../../utilities/Utilities.hpp"
10 : mLeftMotor(leftMotor)
11 , mRightMotor(rightMotor)
29 void DifferentialControl::setMotors()
38 mLeftMotor.
setSpeed(
static_cast<int>(
static_cast<float>(mSpeed) * ratio));
45 mRightMotor.
setSpeed(
static_cast<int>(
static_cast<float>(mSpeed) * ratio));
54 mLeftMotor.
setSpeed(firstMotorSpeed);
55 mRightMotor.
setSpeed(secondMotorSpeed);
void overrideMotorSpeed(int firstMotorSpeed, int secondMotorSpeed) override
Set the motor speed individually as a percentage of the motors` total power.
DifferentialControl(Motor &leftMotor, Motor &rightMotor)
Constructs an Ackerman way of controlling the vehicle.
const int kMaxControlAngle
constexpr AnyNumber getAbsolute(AnyNumber number)
Gets the absolute of the supplied number.
void setSpeed(int speed) override
Sets the driving speed as percentage of the total motor speed where the sign represents the direction...
const int kMinControlAngle
const int kIdleControlAngle
constexpr AnyNumber getConstrain(AnyNumber number, AnyNumber min, AnyNumber max)
Limit the number between a range.
virtual void setSpeed(int speed)=0
Sets the motor speed and direction as the percentage of the maximum possible speed,...
void setAngle(int angle) override
Sets the driving angle in degrees [-90, 90].