global_racetrajectory_optimization
global_racetrajectory_optimization copied to clipboard
Error when the spline_approximation.py function is called in the scope of prep_track.py
I was trying to use this API to get the track yaw angle and curvature based on GPS data to run my laptime sims.
Then I was trying to use your algorithm to understand how you import the track data and get the racing line from it. However, when I try to run the main_globaltraj.py I have this error.
It seems that there is a optimization function being called in line 95 of the spline_approximation function, and the data size of the arguments are wrong.
This was the very same error I had when trying to use only the functions I needed to calculate the curvature analytically.
Here is the error log:
Traceback (most recent call last):
File "/home/pedroc/dev/global_racetrajectory_optimization/main_globaltraj.py", line 243, in
File "/home/pedroc/dev/global_racetrajectory_optimization/venv/lib/python3.10/site-packages/trajectory_planning_helpers/spline_approximation.py", line 95, in spline_approximation
closest_t_glob_cl[i] = optimize.fmin(dist_to_p,
File "/home/pedroc/.local/lib/python3.10/site-packages/scipy/optimize/_optimize.py", line 622, in fmin
res = _minimize_neldermead(func, x0, args, callback=callback, **opts)
File "/home/pedroc/.local/lib/python3.10/site-packages/scipy/optimize/_optimize.py", line 772, in _minimize_neldermead
fsim[k] = func(sim[k])
File "/home/pedroc/.local/lib/python3.10/site-packages/scipy/optimize/_optimize.py", line 496, in function_wrapper
fx = function(np.copy(x), *(wrapper_args + args))
File "/home/pedroc/dev/global_racetrajectory_optimization/venv/lib/python3.10/site-packages/trajectory_planning_helpers/spline_approximation.py", line 146, in dist_to_p
return spatial.distance.euclidean(p, s)
File "/home/pedroc/.local/lib/python3.10/site-packages/scipy/spatial/distance.py", line 518, in euclidean
return minkowski(u, v, p=2, w=w)
File "/home/pedroc/.local/lib/python3.10/site-packages/scipy/spatial/distance.py", line 462, in minkowski
v = _validate_vector(v)
File "/home/pedroc/.local/lib/python3.10/site-packages/scipy/spatial/distance.py", line 301, in _validate_vector
raise ValueError("Input vector should be 1-D.")
ValueError: Input vector should be 1-D.
Process finished with exit code 1