Smartcar Shield
Control.hpp
Go to the documentation of this file.
1 
5 #pragma once
6 
7 namespace smartcarlib
8 {
9 namespace constants
10 {
11 namespace control
12 {
13 const int kMinControlAngle = -90;
14 const int kIdleControlAngle = 0;
15 const int kMaxControlAngle = 90;
16 const int kMinControlSpeed = -100;
17 const int kIdleControlSpeed = 0;
18 const int kMaxControlSpeed = 100;
19 } // namespace control
20 } // namespace constants
21 } // namespace smartcarlib
22 
23 class Control
24 {
25 public:
26  virtual ~Control() = default;
27 
37  virtual void setAngle(int angle) = 0;
38 
49  virtual void setSpeed(int speed) = 0;
50 
62  virtual void overrideMotorSpeed(int firstMotorSpeed, int secondMotorSpeed) = 0;
63 };
smartcarlib::constants::control::kMinControlSpeed
const int kMinControlSpeed
Definition: Control.hpp:16
smartcarlib
Definition: DistanceCar.hpp:11
smartcarlib::constants::control::kIdleControlSpeed
const int kIdleControlSpeed
Definition: Control.hpp:17
smartcarlib::constants::control::kMaxControlAngle
const int kMaxControlAngle
Definition: Control.hpp:15
Control
Definition: Control.hpp:23
Control::setSpeed
virtual void setSpeed(int speed)=0
Sets the driving speed as percentage of the total motor speed where the sign represents the direction...
smartcarlib::constants::control::kMaxControlSpeed
const int kMaxControlSpeed
Definition: Control.hpp:18
Control::setAngle
virtual void setAngle(int angle)=0
Sets the driving angle in degrees [-90, 90].
Control::~Control
virtual ~Control()=default
smartcarlib::constants::control::kMinControlAngle
const int kMinControlAngle
Definition: Control.hpp:13
smartcarlib::constants::control::kIdleControlAngle
const int kIdleControlAngle
Definition: Control.hpp:14
Control::overrideMotorSpeed
virtual void overrideMotorSpeed(int firstMotorSpeed, int secondMotorSpeed)=0
Set the motor speed individually as a percentage of the motors` total power.