forked from team8/FRC-2017-Public
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTuningGraph.py
More file actions
45 lines (31 loc) · 1.24 KB
/
TuningGraph.py
File metadata and controls
45 lines (31 loc) · 1.24 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
import sys
import matplotlib.pyplot as plt
assert len(sys.argv) > 1
path_to_output = sys.argv[1]
# index = int(sys.argv[2])
FILE_SEPARATOR = "," # The default is space separated values. This can be changed to comma seperated
f = open(path_to_output, "r").readlines()
data = [i.split(FILE_SEPARATOR) for i in f]
plt.title("Graph of {}".format(path_to_output.split("/")[-1].split(".")[0]))
plt.grid(True)
plt.xlabel("X Position")
plt.ylabel("Y Position")
# 0 is error, 1 is output, 2 is distance so far, 3 is calculated velocity, 4 desired velocity, 5 desired acceleration
data_y = [i[0] for i in data]
data_x = [i for i in range(len(data_y))]
# desired degrees, supposed heading, calculated error
data_y_2 = [i[1] for i in data]
data_x_2 = [i for i in range(len(data_y_2))]
data_y_3 = [i[2] for i in data]
data_x_3 = [i for i in range(len(data_y_3))]
data_y_4 = [i[3] for i in data]
data_x_4 = [i for i in range(len(data_y_4))]
data_y_5 = [i[4] for i in data]
data_x_5 = [i for i in range(len(data_y_5))]
# plt.axis('equal')
plt.scatter(data_x, data_y, color="b")
plt.scatter(data_x_2, data_y_2, color='r')
plt.scatter(data_x_3, data_y_3, color='g')
plt.scatter(data_x_4, data_y_4, color='yellow')
plt.scatter(data_x_5, data_y_5, color='purple')
plt.show()