ME 405 Romi
Loading...
Searching...
No Matches
data_collector.py
Go to the documentation of this file.
1
6
class
data_collector
:
7
8
18
def
__init__
(self, testing_flg, position, velocity, times, position_l, velocity_l,position_r, velocity_r, velocity2):
19
self.
testing_flg
=testing_flg
20
self.
position
=position
21
self.
velocity
= velocity
22
self.
times
= times
23
self.
position_l
= position_l
24
self.
velocity_l
= velocity_l
25
self.
position_r
= position_r
26
self.
velocity_r
= velocity_r
27
self.
velocity2
= velocity2
28
self.
state
= 1
29
42
def
run
(self):
43
44
while
True
:
45
# Wait for data collection call
46
if
self.
state
== 1:
47
if
self.
testing_flg
.get() != 0:
48
self.
state
= self.
testing_flg
.get()
49
yield
1
50
# Queue velocity of left motor
51
elif
self.
state
==2:
52
if
self.
testing_flg
.get() == 0:
53
self.
state
= 1
54
self.
velocity
.put(self.
velocity_l
.get())
55
yield
2
56
# Queue velocity of right motor
57
elif
self.
state
== 3:
58
if
self.
testing_flg
.get() == 0:
59
self.
state
= 1
60
self.
velocity
.put(self.
velocity_r
.get())
61
yield
3
62
# Queue position of left motor
63
elif
self.
state
== 4:
64
if
self.
testing_flg
.get() == 0:
65
self.
state
= 1
66
self.
position
.put(self.
position_l
.get())
67
yield
4
68
# Queue position of right motor
69
elif
self.
state
== 5:
70
if
self.
testing_flg
.get() == 0:
71
self.
state
= 1
72
self.
position
.put(self.
position_r
.get())
73
yield
5
74
# Queue both motor velocities at the same time
75
elif
self.
state
== 6:
76
if
self.
testing_flg
.get() == 0:
77
self.
state
= 1
78
self.
velocity
.put(self.
velocity_l
.get())
79
self.
velocity2
.put(self.
velocity_r
.get())
80
yield
6
81
else
:
82
raise
ValueError(
"Not that many states"
)
83
yield
self.
state
data_collector.data_collector
Collects data from shares.
Definition
data_collector.py:6
data_collector.data_collector.velocity2
velocity2
Definition
data_collector.py:27
data_collector.data_collector.state
int state
Definition
data_collector.py:28
data_collector.data_collector.times
times
Definition
data_collector.py:22
data_collector.data_collector.velocity_r
velocity_r
Definition
data_collector.py:26
data_collector.data_collector.testing_flg
testing_flg
Definition
data_collector.py:19
data_collector.data_collector.position
position
Definition
data_collector.py:20
data_collector.data_collector.velocity_l
velocity_l
Definition
data_collector.py:24
data_collector.data_collector.__init__
__init__(self, testing_flg, position, velocity, times, position_l, velocity_l, position_r, velocity_r, velocity2)
Data Collector Initialization.
Definition
data_collector.py:18
data_collector.data_collector.run
run(self)
Runs the various tasks Data Collector.
Definition
data_collector.py:42
data_collector.data_collector.velocity
velocity
Definition
data_collector.py:21
data_collector.data_collector.position_l
position_l
Definition
data_collector.py:23
data_collector.data_collector.position_r
position_r
Definition
data_collector.py:25
vscode_python
data_collector.py
Generated by
1.15.0