-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.py
62 lines (49 loc) · 2.23 KB
/
main.py
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
import pandas as pd
from utils import MeasurementPacket, calculate_rmse, passing_rmse
from tracker import Tracker
def runTracker(data_path):
'''
This is simulating our sensors data stream.
***Note***
This is not a generator so if your sample log file is huge it'll load it
all into memory. For now this is acceptable ;)
'''
data_packets = pd.read_csv(data_path,
header=None,
sep='\t',
names=['x'+str(x) for x in range(9)])
'''
For now we are only tracking one object, hence we only need one Tracker.
If the vehicle seen for example three people and three cars we'd need six trackers.
So you'd ideally have a list of trackers going at once. However, I could be wrong!
'''
tracker = Tracker()
'''
This is the main loop that updates and tracks the objects.
EKF style!
'''
estimations = []
measurements = []
for _ , raw_measurement_packet in data_packets.iterrows():
measurement_packet = MeasurementPacket(raw_measurement_packet)
measurements.append(measurement_packet)
tracker.process_measurement(measurement_packet)
estimations.append(tracker.state)
return estimations, measurements
if __name__ == '__main__':
print("Started Tracker for sample-laser-radar-measurement-data-1.txt")
estimations, measurements = runTracker('./data/sample-laser-radar-measurement-data-1.txt')
print("estimations count: ", len(estimations))
print("measurements count: ", len(measurements))
rmse = calculate_rmse(estimations, [m.ground_truth for m in measurements]).flatten()
print("RMSE: ", rmse)
#check if we passed metric for data1 log file.
passing_rmse(rmse, [0.08, 0.08, 0.60, 0.60])
print("\n\nStarted Tracker for sample-laser-radar-measurement-data-2.txt")
estimations, measurements = runTracker('./data/sample-laser-radar-measurement-data-2.txt')
print("estimations count: ", len(estimations))
print("measurements count: ", len(measurements))
rmse = calculate_rmse(estimations, [m.ground_truth for m in measurements]).flatten()
print("RMSE: ", rmse)
#check if we passed metric for data2 log file.
passing_rmse(rmse, [0.20, 0.20, .50, .85])