Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
offsettrack.py
Go to the documentation of this file.
1# pylint: skip-file
2# mypy: ignore-errors
3"""!
4Code to add outliers to a track in a file used for testing
5"""
6
7x_values = []
8y_values = []
9c_values = []
10
11with open("map_250.txt", "r") as file:
12 for line in file:
13 line = line.strip() # Remove leading/trailing whitespace
14 if line:
15 x, y, c = line.split()
16 x_values.append(float(x))
17 y_values.append(float(y))
18 c_values.append(c)
19
20
21f = open("map_250_out10.txt", "w")
22count = 0
23
24for i in range(len(x_values)):
25 if i % 25 == 0:
26 f.write(
27 str(x_values[i] + 3) + " " + str(y_values[i]) + " " + c_values[i] + "\n"
28 )
29 else:
30 f.write(str(x_values[i]) + " " + str(y_values[i]) + " " + c_values[i] + "\n")
31
32f.close()