RoboidControl
Loading...
Searching...
No Matches
Angle8.h
Go to the documentation of this file.
1#include "AngleUsing.h"
2
3#include "Angle.h"
4#include <math.h>
5
6namespace Passer {
7namespace LinearAlgebra {
8
10
11template <> Angle8::AngleUsing(float angle) {
12 if (!isfinite(angle)) {
13 value = 0;
14 return;
15 }
16
17 // map float [-180..180) to integer [-128..127]
18 float f = angle / 360.0F;
19 this->value = (signed char)(f * 256.0F);
20}
21
22template <> float Angle8::ToFloat() const {
23 float f = (this->value * 180) / 128.0F;
24 return f;
25}
26
27} // namespace LinearAlgebra
28} // namespace Passer
29using namespace Passer::LinearAlgebra;
Definition AngleUsing.h:12
T value
Definition AngleUsing.h:42
float ToFloat() const
Definition Angle16.h:21
AngleUsing(T sourceValue)
Definition AngleUsing.h:14
Definition Angle.h:9
AngleUsing< signed char > Angle8
Definition Angle8.h:9
Definition AbsoluteEncoder.h:5