-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGiroscope.cpp
More file actions
72 lines (58 loc) · 1.34 KB
/
Giroscope.cpp
File metadata and controls
72 lines (58 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "Giroscope.h"
Giroscope::Giroscope(const std::string &n, const std::string &m, const std::string &d,const std::vector<double>& mis, const double& p, const double& v) : MovSens(p, v), Sensor(n,m,d,mis), second_pos(0), tempo1(0), tempo2(0) {};
double Giroscope::getSecPos() const
{
return second_pos;
}
void Giroscope::setSecPos(double pos)
{
second_pos = pos;
}
void Giroscope::setTempo1(int temp)
{
tempo1 = temp;
}
void Giroscope::setTempo2(int temp)
{
tempo2 = temp;
}
int Giroscope::getTempo1() const
{
return tempo1;
}
int Giroscope::getTempo2() const
{
return tempo2;
}
void Giroscope::setName(const std::string &nam)
{
name = nam;
}
void Giroscope::setModel(const std::string &mod)
{
model = mod;
}
std::string Giroscope::getName() const
{
return name;
}
std::string Giroscope::getModel() const
{
return model;
}
void Giroscope::addMisuration(const std::function<double (double, double)> &clamp)
{
float deltaTempo = (tempo2 - tempo1);
float variazione_angolo = (second_pos - getPosition2());
float omega = variazione_angolo / deltaTempo;
double misuration = omega * deltaTempo;// *3
misurations.push_back(clamp(misuration, 25));
}
std::string Giroscope::getDescription() const
{
return description;
}
void Giroscope::setDescription(const std::string & d)
{
description = d;
}