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

#include <Car.hpp>

Inheritance diagram for Car:
Inheritance graph
Collaboration diagram for Car:
Collaboration graph

Public Member Functions

virtual ~Car ()=default
 
virtual void setSpeed (float speed)=0
 Sets the car's driving speed. More...
 
virtual void setAngle (int angle)=0
 Set the car's driving angle. 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

An interface to programmatically represent any kind of vehicle

Definition at line 7 of file Car.hpp.

Constructor & Destructor Documentation

◆ ~Car()

virtual Car::~Car ( )
virtualdefault

Member Function Documentation

◆ overrideMotorSpeed()

virtual void Car::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 speed of the motor passed as first argument argument to the car's control class [-100, 100]
secondMotorSpeedThe speed of the motor passed as second argument argument to the car's control class [-100, 100]

Example:

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

Implemented in DistanceCar, and SimpleCar.

◆ setAngle()

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

Set the car's driving angle.

Parameters
angleThe car's angle in degrees [-90, 90]

Example:

car.setAngle(20);

Implemented in SimpleCar.

◆ setSpeed()

virtual void Car::setSpeed ( float  speed)
pure virtual

Sets the car's driving speed.

Parameters
speedThe car's speed

Implemented in DistanceCar, and SimpleCar.


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