Smartcar Shield
Public Member Functions | List of all members
AckermanControl Class Reference

#include <AckermanControl.hpp>

Inheritance diagram for AckermanControl:
Inheritance graph
Collaboration diagram for AckermanControl:
Collaboration graph

Public Member Functions

 AckermanControl (Motor &steering, Motor &throttling)
 Constructs an Ackerman way of controlling the vehicle. More...
 
void setAngle (int angle) override
 Sets the driving angle in degrees [-90, 90]. More...
 
void setSpeed (int speed) override
 Sets the driving speed as percentage of the total motor speed where the sign represents the direction of movement [-100, 100]. More...
 
void overrideMotorSpeed (int firstMotorSpeed, int secondMotorSpeed) override
 Set the motor speed individually as a percentage of the motors` total power. More...
 
- Public Member Functions inherited from Control
virtual ~Control ()=default
 

Detailed Description

Class to represent controling a vehicle by changing the angle of the front wheels, like a common car.

Definition at line 11 of file AckermanControl.hpp.

Constructor & Destructor Documentation

◆ AckermanControl()

AckermanControl::AckermanControl ( Motor steering,
Motor throttling 
)

Constructs an Ackerman way of controlling the vehicle.

Parameters
steeringThe motor that controls the steering
throttlingThe motor that controls the throttling

Example:

BrushedMotor motor(8, 10, 9);
ServoMotor steeringWheel(7);
AckermanControl control(steeringWheel, motor);

Definition at line 9 of file AckermanControl.cpp.

Member Function Documentation

◆ overrideMotorSpeed()

void AckermanControl::overrideMotorSpeed ( int  firstMotorSpeed,
int  secondMotorSpeed 
)
overridevirtual

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

Implements Control.

Definition at line 31 of file AckermanControl.cpp.

Here is the call graph for this function:

◆ setAngle()

void AckermanControl::setAngle ( int  angle)
overridevirtual

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

Parameters
angleThe driving angle

Example:

control.setAngle(90);

Implements Control.

Definition at line 15 of file AckermanControl.cpp.

Here is the call graph for this function:

◆ setSpeed()

void AckermanControl::setSpeed ( int  speed)
overridevirtual

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

Implements Control.

Definition at line 25 of file AckermanControl.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files:
BrushedMotor
Definition: BrushedMotor.hpp:41
AckermanControl
Definition: AckermanControl.hpp:11
ServoMotor
Definition: ServoMotor.hpp:29