forked from James-AIIP-2018/Intensive1Hackathon1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDistanceVerification.py
More file actions
40 lines (31 loc) · 1.01 KB
/
DistanceVerification.py
File metadata and controls
40 lines (31 loc) · 1.01 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
'''
Created on 20 Feb 2018
@author: james + susan + seloke
'''
import math
import csv
# List initialisation
distanceSensors = []
# Open a csv file containing distance data
with open("at_distance_sensors.csv", "rU") as dataFile:
rowCount=0
# Read the dataset into a list
csv_reader = csv.reader(dataFile, delimiter=',')
for row in csv_reader:
if rowCount <> 0:
if row[0] == '':
row[0] = 'end'
if row[2] == '':
row[2] = 0
temp = [str(row[0]), float(row[1]), float(row[2])]
distanceSensors.append(temp)
rowCount = rowCount +1
totalDistance = 1011.79591667
cumulativeDistance = 0
for items in distanceSensors:
cumulativeDistance = cumulativeDistance + items[1]
#print(cumulativeDistance + items[2])
temp = cumulativeDistance + items[2]
print(str(temp)+ " "+ str(totalDistance))
if (temp - totalDistance) == 0:
print("Sensor: "+items[0]+", distance verification failed.")