3#include "../../utilities/Utilities.hpp"
10 : mLeftMotor(leftMotor)
11 , mRightMotor(rightMotor)
27void DifferentialControl::setMotors()
36 mLeftMotor.
setSpeed(
static_cast<int>(
static_cast<float>(mSpeed) * ratio));
43 mRightMotor.
setSpeed(
static_cast<int>(
static_cast<float>(mSpeed) * ratio));
52 mLeftMotor.
setSpeed(firstMotorSpeed);
53 mRightMotor.
setSpeed(secondMotorSpeed);
DifferentialControl(Motor &leftMotor, Motor &rightMotor)
Constructs an Ackerman way of controlling the vehicle.
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.
virtual void setSpeed(int speed)=0
Sets the motor speed and direction as the percentage of the maximum possible speed,...
const int kIdleControlAngle
const int kMinControlAngle
const int kMaxControlAngle
constexpr AnyNumber getConstrain(AnyNumber number, AnyNumber min, AnyNumber max)
Limit the number between a range.
constexpr AnyNumber getAbsolute(AnyNumber number)
Gets the absolute of the supplied number.