Smartcar Shield
Public Member Functions | List of all members
Control Interface Referenceabstract

#include <Control.hpp>

Inheritance diagram for Control:
Inheritance graph
Collaboration diagram for Control:
Collaboration graph

Public Member Functions

virtual ~Control ()=default
 
virtual void setAngle (int angle)=0
 Sets the driving angle in degrees [-90, 90]. More...
 
virtual void setSpeed (int speed)=0
 Sets the driving speed as percentage of the total motor speed where the sign represents the direction of movement [-100, 100]. More...
 
virtual void overrideMotorSpeed (int firstMotorSpeed, int secondMotorSpeed)=0
 Set the motor speed individually as a percentage of the motors` total power. More...
 

Detailed Description

Interface to generalize all classes that can provide a way to control a Car

Definition at line 23 of file Control.hpp.

Constructor & Destructor Documentation

◆ ~Control()

virtual Control::~Control ( )
virtualdefault

Member Function Documentation

◆ overrideMotorSpeed()

virtual void Control::overrideMotorSpeed ( int  firstMotorSpeed,
int  secondMotorSpeed 
)
pure virtual

Set the motor speed individually as a percentage of the motors` total power.

Use this with caution.

Parameters
firstMotorSpeedThe first motor speed [-100, 100]
secondMotorSpeedThe second motor speed [-100, 100]

Example:

control.overrideMotorSpeed(100, -100); // Make the car spin around clockwise

Implemented in AckermanControl, and DifferentialControl.

Here is the caller graph for this function:

◆ setAngle()

virtual void Control::setAngle ( int  angle)
pure virtual

Sets the driving angle in degrees [-90, 90].

Parameters
angleThe driving angle

Example:

control.setAngle(90);

Implemented in AckermanControl, and DifferentialControl.

Here is the caller graph for this function:

◆ setSpeed()

virtual void Control::setSpeed ( int  speed)
pure virtual

Sets the driving speed as percentage of the total motor speed where the sign represents the direction of movement [-100, 100].

Parameters
speedThe driving speed

Example:

control.setSpeed(-100); // Full speed backward

Implemented in AckermanControl, and DifferentialControl.

Here is the caller graph for this function:

The documentation for this interface was generated from the following file: