Smartcar Shield
src
control
differential
DifferentialControl.hpp
Go to the documentation of this file.
1
6
#pragma once
7
8
#include "../../motor/Motor.hpp"
9
#include "../Control.hpp"
10
11
class
DifferentialControl
:
public
Control
12
{
13
public
:
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
37
private
:
38
void
setMotors();
39
Motor
& mLeftMotor;
40
Motor
& mRightMotor;
41
int
mAngle;
42
int
mSpeed;
43
};
DifferentialControl::overrideMotorSpeed
void overrideMotorSpeed(int firstMotorSpeed, int secondMotorSpeed) override
Set the motor speed individually as a percentage of the motors` total power.
Definition:
DifferentialControl.cpp:49
DifferentialControl::DifferentialControl
DifferentialControl(Motor &leftMotor, Motor &rightMotor)
Constructs an Ackerman way of controlling the vehicle.
Definition:
DifferentialControl.cpp:9
Motor
Definition:
Motor.hpp:22
Control
Definition:
Control.hpp:23
DifferentialControl
Definition:
DifferentialControl.hpp:11
DifferentialControl::setSpeed
void setSpeed(int speed) override
Sets the driving speed as percentage of the total motor speed where the sign represents the direction...
Definition:
DifferentialControl.cpp:23
DifferentialControl::setAngle
void setAngle(int angle) override
Sets the driving angle in degrees [-90, 90].
Definition:
DifferentialControl.cpp:17
Generated by
1.8.17