Smartcar Shield
src
sensors
odometer
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
11
namespace
smartcarlib
12
{
13
namespace
constants
14
{
15
namespace
odometer
16
{
17
const
int8_t
kForward
= 1;
18
const
int8_t
kBackward
= -1;
19
const
int8_t
kIdle
= 0;
20
const
unsigned
long
kDefaultPulsesPerMeter
= 100;
// 1:1 cm to pulses ratio
21
const
unsigned
long
kMinimumPulseGap
= 700;
22
}
// namespace odometer
23
}
// namespace constants
24
}
// namespace smartcarlib
25
26
class
Odometer
27
{
28
public
:
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
};
smartcarlib
Definition:
DistanceCar.hpp:11
smartcarlib::constants::odometer::kIdle
const int8_t kIdle
Definition:
Odometer.hpp:19
Odometer
Definition:
Odometer.hpp:26
Odometer::getSpeed
virtual float getSpeed()=0
Returns the current speed in meters/sec where sign can indicate direction if there is hardware suppor...
Odometer::isAttached
virtual bool isAttached() const =0
Returns whether the sensor has been properly attached.
Odometer::providesDirection
virtual bool providesDirection() const =0
Return whether the sensor is capable of inferring the direction of movement.
smartcarlib::constants::odometer::kMinimumPulseGap
const unsigned long kMinimumPulseGap
Definition:
Odometer.hpp:21
smartcarlib::constants::odometer::kBackward
const int8_t kBackward
Definition:
Odometer.hpp:18
Odometer::~Odometer
virtual ~Odometer()=default
smartcarlib::constants::odometer::kForward
const int8_t kForward
Definition:
Odometer.hpp:17
smartcarlib::constants::odometer::kDefaultPulsesPerMeter
const unsigned long kDefaultPulsesPerMeter
Definition:
Odometer.hpp:20
Odometer::getDistance
virtual long getDistance()=0
Returns the travelled distance in centimeters where sign can indicate direction if there is hardware ...
Generated by
1.8.17