import numpy as np
import math
import csv
import matplotlib.pyplot as plt
means, stdd, map_x, map_y = [], [], [], []
data = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]
extension = ".csv"
def data_read():
for i in range(0,36):
if i == 0:
d_file = "LIDAR_100ms_Degrees_00"
elif i<10 and i>0:
d_file = "LIDAR_100ms_Degrees_0"
else:
d_file = "LIDAR_100ms_Degrees_"
filename = d_file + str(i*10) + extension
with open(filename, 'r') as datafile:
data1 = csv.reader(datafile)
for p1 in data1:
data[i].append(int(p1[0]))
means.append(np.mean(data[i]))
stdd.append(np.std(data[i]))
map_x.append(means[i]*math.cos(math.radians(i*10)))
map_y.append(means[i]*math.sin(math.radians(i*10)))
def plot_1a():
plt.plot(means, stdd, 'r*')
plt.grid()
plt.ylabel("Standard Deviation for range measurement")
plt.xlabel("Mean of the range measurement at each angle")
plt.show()
def plot_1b():
map_x.append(map_x[0])
map_y.append(map_y[0])
plt.grid(True)
plt.plot(map_x, map_y, 'g*--')
plt.plot([1],[1], 'ro')
plt.xlabel('Distances from the origin on both x and y axes, for the map \n Moving 10 degrees anti-clockwise')
plt.ylabel('The red point is the origin for the robot \n positive x-axis is 0 degrees azimuth and angle is increamented anti-clockwise')
plt.show()
data_read()
plot_1a()
plot_1b()