Smartcar Shield
HeadingCar.cpp
Go to the documentation of this file.
1 #include "HeadingCar.hpp"
2 
3 HeadingCar::HeadingCar(Control& control, HeadingSensor& headingSensor)
4  : SimpleCar(control)
5  , mHeadingSensor(headingSensor)
6 {
7 }
8 
10 {
11  return mHeadingSensor.getHeading();
12 }
13 
15 {
16  mHeadingSensor.update();
17 }
HeadingCar.hpp
HeadingCar::HeadingCar
HeadingCar(Control &control, HeadingSensor &headingSensor)
Constructs a car equipped with a heading sensor.
Definition: HeadingCar.cpp:3
Control
Definition: Control.hpp:23
HeadingSensor::update
virtual void update()=0
Updates the sensor's readings.
HeadingSensor
Definition: HeadingSensor.hpp:8
HeadingCar::update
virtual void update()
Updates the readings from the heading sensor.
Definition: HeadingCar.cpp:14
SimpleCar
Definition: SimpleCar.hpp:10
HeadingCar::getHeading
int getHeading()
Returns the car's current heading in degrees [0, 360)
Definition: HeadingCar.cpp:9
HeadingSensor::getHeading
virtual int getHeading()=0
Returns the current heading of the vehicle.