Smartcar Shield
Loading...
Searching...
No Matches
Odometer.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <stdint.h> // NOLINT(modernize-deprecated-headers)
8
9#include "../../runtime/InterruptCallback.hpp"
10
11namespace smartcarlib
12{
13namespace constants
14{
15namespace odometer
16{
17const int8_t kForward = 1;
18const int8_t kBackward = -1;
19const int8_t kIdle = 0;
20const unsigned long kDefaultPulsesPerMeter = 100; // 1:1 cm to pulses ratio
21const unsigned long kMinimumPulseGap = 700;
22} // namespace odometer
23} // namespace constants
24} // namespace smartcarlib
25
27{
28public:
29 virtual ~Odometer() = default;
30
41 virtual long getDistance() = 0;
42
53 virtual float getSpeed() = 0;
54
64 virtual bool isAttached() const = 0;
65
75 virtual bool providesDirection() const = 0;
76};
An interface to programmatically represent all odometers.
Definition Odometer.hpp:27
virtual bool providesDirection() const =0
Return whether the sensor is capable of inferring the direction of movement.
virtual long getDistance()=0
Returns the travelled distance in centimeters where sign can indicate direction if there is hardware ...
virtual float getSpeed()=0
Returns the current speed in meters/sec where sign can indicate direction if there is hardware suppor...
virtual bool isAttached() const =0
Returns whether the sensor has been properly attached.
virtual ~Odometer()=default
const unsigned long kMinimumPulseGap
Definition Odometer.hpp:21
const unsigned long kDefaultPulsesPerMeter
Definition Odometer.hpp:20