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

#include <Odometer.hpp>

Inheritance diagram for Odometer:
Inheritance graph
Collaboration diagram for Odometer:
Collaboration graph

Public Member Functions

virtual ~Odometer ()=default
 
virtual long getDistance ()=0
 Returns the travelled distance in centimeters where sign can indicate direction if there is hardware support. More...
 
virtual float getSpeed ()=0
 Returns the current speed in meters/sec where sign can indicate direction if there is hardware support. More...
 
virtual bool isAttached () const =0
 Returns whether the sensor has been properly attached. More...
 
virtual bool providesDirection () const =0
 Return whether the sensor is capable of inferring the direction of movement. More...
 

Detailed Description

An interface to programmatically represent all odometers

Definition at line 26 of file Odometer.hpp.

Constructor & Destructor Documentation

◆ ~Odometer()

virtual Odometer::~Odometer ( )
virtualdefault

Member Function Documentation

◆ getDistance()

virtual long Odometer::getDistance ( )
pure virtual

Returns the travelled distance in centimeters where sign can indicate direction if there is hardware support.

Returns
The travelled distance in centimeters

Example:

unsigned long travelledDistance = odometer.getDistance();

Implemented in DirectionalOdometer, and DirectionlessOdometer.

Here is the caller graph for this function:

◆ getSpeed()

virtual float Odometer::getSpeed ( )
pure virtual

Returns the current speed in meters/sec where sign can indicate direction if there is hardware support.

Returns
The speed in meters/sec

Example:

float speed = odometer.getSpeed();

Implemented in DirectionalOdometer, and DirectionlessOdometer.

Here is the caller graph for this function:

◆ isAttached()

virtual bool Odometer::isAttached ( ) const
pure virtual

Returns whether the sensor has been properly attached.

Returns
True if Odometer::attach has been successfully run, false otherwise Example:
bool hasAttachBeenRun = odometer.isAttached();

Implemented in DirectionlessOdometer.

◆ providesDirection()

virtual bool Odometer::providesDirection ( ) const
pure virtual

Return whether the sensor is capable of inferring the direction of movement.

Returns
true if the sensor supports direction readings otherwise false

Example:

bool directional = odometer.providesDirection();

Implemented in DirectionalOdometer, and DirectionlessOdometer.


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