TUMFTM / global_racetrajectory_optimization

This repository contains multiple approaches for generating global racetrajectories.
GNU Lesser General Public License v3.0
437 stars 177 forks source link

3D velocity plot does not graph #4

Closed mheidebr closed 3 years ago

mheidebr commented 3 years ago

Description

When running the global trajectory planner the 3d velocity profile does not graph. The script exits with the following traceback:

Traceback (most recent call last):
  File ".\main_globaltraj.py", line 583, in <module>
    trajectory=trajectory_opt)
  File "C:\Users\PC1\Documents\git\global_racetrajectory_optimization\helper_funcs_glob\src\result_plots.py", line 102, in result_plots
    ax.set_aspect("equal")
  File "C:\Users\PC1\Documents\git\global_racetrajectory_optimization\.env\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 324, in set_aspect
    "Axes3D currently only supports the aspect argument "
NotImplementedError: Axes3D currently only supports the aspect argument 'auto'. You passed in 'equal'.

Proposed solution

File: helper_funcs_glob\src\result_plots.py Line: 102 Original: ax.set_aspect("equal") Proposed change: ax.set_aspect("auto") With proposed change the charts are displayed successfully

Working environment

(.env) PS C:\Users\PC1\Documents\git\global_racetrajectory_optimization> pip freeze
casadi==3.5.1
certifi==2020.12.5
cycler==0.10.0
Cython==0.29.22
joblib==1.0.1
kiwisolver==1.3.1
matplotlib==3.3.1
numpy==1.18.1
Pillow==8.1.0
pyparsing==2.4.7
python-dateutil==2.8.1
quadprog==0.1.7
scikit-learn==0.23.1
scipy==1.3.3
six==1.15.0
threadpoolctl==2.1.0
trajectory-planning-helpers==0.71
(.env) PS C:\Users\PC1\Documents\git\global_racetrajectory_optimization> python --version
Python 3.7.7

OS version

OS Name Microsoft Windows 10 Pro Version 10.0.19041 Build 19041

User Input

User input in main_globaltraj.py

# ----------------------------------------------------------------------------------------------------------------------
# USER INPUT -----------------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------

# choose vehicle parameter file ----------------------------------------------------------------------------------------
file_paths = {"veh_params_file": "racecar.ini"}

# debug and plot options -----------------------------------------------------------------------------------------------
debug = True                                    # print console messages
plot_opts = {"mincurv_curv_lin": False,         # plot curv. linearization (original and solution based) (mincurv only)
             "raceline": True,                  # plot optimized path
             "imported_bounds": False,          # plot imported bounds (analyze difference to interpolated bounds)
             "raceline_curv": False,             # plot curvature profile of optimized path
             "racetraj_vel": True,              # plot velocity profile
             "racetraj_vel_3d": True,          # plot 3D velocity profile above raceline
             "racetraj_vel_3d_stepsize": 1.0,   # [m] vertical lines stepsize in 3D velocity profile plot
             "spline_normals": True,           # plot spline normals to check for crossings
             "mintime_plots": False}            # plot states, controls, friction coeffs etc. (mintime only)

# select track file (including centerline coordinates + track widths) --------------------------------------------------
# file_paths["track_name"] = "rounded_rectangle"                              # artificial track
# file_paths["track_name"] = "handling_track"                                 # artificial track
file_paths["track_name"] = "berlin_2018"                                    # Berlin Formula E 2018
# file_paths["track_name"] = "modena_2019"                                    # Modena 2019

# set import options ---------------------------------------------------------------------------------------------------
imp_opts = {"flip_imp_track": False,                # flip imported track to reverse direction
            "set_new_start": False,                 # set new starting point (changes order, not coordinates)
            "new_start": np.array([0.0, -47.0]),    # [x_m, y_m]
            "min_track_width": None,                # [m] minimum enforced track width (set None to deactivate)
            "num_laps": 1}                          # number of laps to be driven (significant with powertrain-option),
                                                    # only relevant in mintime-optimization

# set optimization type ------------------------------------------------------------------------------------------------
# 'shortest_path'       shortest path optimization
# 'mincurv'             minimum curvature optimization without iterative call
# 'mincurv_iqp'         minimum curvature optimization with iterative call
# 'mintime'             time-optimal trajectory optimization
opt_type = 'mintime'

# set mintime specific options (mintime only) --------------------------------------------------------------------------
# tpadata:                      set individual friction map data file if desired (e.g. for varmue maps), else set None,
#                               e.g. "berlin_2018_varmue08-12_tpadata.json"
# warm_start:                   [True/False] warm start IPOPT if previous result is available for current track
# var_friction:                 [-] None, "linear", "gauss" -> set if variable friction coefficients should be used
#                               either with linear regression or with gaussian basis functions (requires friction map)
# reopt_mintime_solution:       reoptimization of the mintime solution by min. curv. opt. for improved curv. smoothness
# recalc_vel_profile_by_tph:    override mintime velocity profile by ggv based calculation (see TPH package)

mintime_opts = {"tpadata": None,
                "warm_start": False,
                "var_friction": None,
                "reopt_mintime_solution": False,
                "recalc_vel_profile_by_tph": False}

# lap time calculation table -------------------------------------------------------------------------------------------
lap_time_mat_opts = {"use_lap_time_mat": False,             # calculate a lap time matrix (diff. top speeds and scales)
                     "gg_scale_range": [0.3, 1.0],          # range of gg scales to be covered
                     "gg_scale_stepsize": 0.05,             # step size to be applied
                     "top_speed_range": [100.0, 150.0],     # range of top speeds to be simulated [in km/h]
                     "top_speed_stepsize": 5.0,             # step size to be applied
                     "file": "lap_time_matrix.csv"}         # file name of the lap time matrix (stored in "outputs")
heilmeiera commented 3 years ago

Is resolved, thanks for your suggestions!