RoboidControl
Loading...
Searching...
No Matches
Angle16.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 <> Angle16::AngleUsing(float angle) {
12 if (!isfinite(angle)) {
13 value = 0;
14 return;
15 }
16
17 // map float [-180..180) to integer [-32768..32767]
18 this->value = (signed short)((angle / 360.0F) * 65536.0F);
19}
20
21template <> float Angle16::ToFloat() const {
22 float f = ((this->value * 180) / 32768.0F);
23 return f;
24}
25
26} // namespace LinearAlgebra
27} // namespace Passer
28using 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 short > Angle16
Definition Angle16.h:9
Definition AbsoluteEncoder.h:5