Skip to content

Commit

Permalink
Extended tire generation script capabilites
Browse files Browse the repository at this point in the history
  • Loading branch information
ohyeah2389 committed Feb 17, 2025
1 parent 050cb7b commit 34b683f
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 23 deletions.
Binary file added Renders/render7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Renders/render8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Source/base/data/tire_kart_sprint_front_lat.lut
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.106
40000 | 0.106

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.3
;SLOPE_0 6
Expand Down
2 changes: 1 addition & 1 deletion Source/base/data/tire_kart_sprint_front_long.lut
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.276
40000 | 0.276

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.3
;SLOPE_0 6
Expand Down
2 changes: 1 addition & 1 deletion Source/base/data/tire_kart_sprint_rear_lat.lut
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.506
40000 | 0.506

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.5
;SLOPE_0 4
Expand Down
2 changes: 1 addition & 1 deletion Source/base/data/tire_kart_sprint_rear_long.lut
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.856
40000 | 0.856

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.5
;SLOPE_0 4
Expand Down
25 changes: 11 additions & 14 deletions Utilities/generate_tire_lut.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
from datetime import datetime


def generate_input_values():
def generate_input_values(ranges):
"""Generate the sequence of input values according to the specified increments"""
values = []

# 0 to 400 in steps of 20
values.extend(np.arange(0, 401, 20))
values.extend(np.arange(0, ranges['by_twentys'] + 1, 20))

# 400 to 3000 in steps of 100
values.extend(np.arange(400, 3001, 100))
values.extend(np.arange(ranges['by_twentys'], ranges['by_hundreds'] + 1, 100))

# 3000 to 40000 in steps of 500
values.extend(np.arange(3000, 40001, 500))
values.extend(np.arange(ranges['by_hundreds'], ranges['by_fivehundreds'] + 1, 500))

# Remove duplicates that might occur at transition points
return sorted(list(set(values)))
Expand Down Expand Up @@ -62,7 +62,7 @@ def load_parameters(config_file):
try:
with open(config_file, 'rb') as f:
config = tomli.load(f)
return config['front_tire'], config['rear_tire']
return config['front_tire'], config['rear_tire'], config['base_path'], config['ranges']
except FileNotFoundError:
print(f"Error: Configuration file '{config_file}' not found.")
print("Please ensure tire_parameters.toml exists in the same directory as this script.")
Expand Down Expand Up @@ -101,21 +101,18 @@ def generate_all_luts(config_file='tire_parameters.toml'):
print("Tire LUT Generator")

# Load parameters from TOML file
front_params, rear_params = load_parameters(config_file)
front_params, rear_params, base_path, ranges = load_parameters(config_file)
print("\nLoaded parameters from", config_file)

# Get input values
x_values = generate_input_values()

# Fixed output path
base_path = "../ohyeah2389_modkart_class2/data"
x_values = generate_input_values(ranges)

# Generate all four files
tire_configs = [
("front_lat", f"{base_path}/tire_kart_sprint_front_lat.lut", front_params, True),
("front_long", f"{base_path}/tire_kart_sprint_front_long.lut", front_params, False),
("rear_lat", f"{base_path}/tire_kart_sprint_rear_lat.lut", rear_params, True),
("rear_long", f"{base_path}/tire_kart_sprint_rear_long.lut", rear_params, False)
("front_lat", f"{base_path['path']}/{base_path['front_tire_lat_file']}", front_params, True),
("front_long", f"{base_path['path']}/{base_path['front_tire_long_file']}", front_params, False),
("rear_lat", f"{base_path['path']}/{base_path['rear_tire_lat_file']}", rear_params, True),
("rear_long", f"{base_path['path']}/{base_path['rear_tire_long_file']}", rear_params, False)
]

for name, filename, params, is_lateral in tire_configs:
Expand Down
14 changes: 13 additions & 1 deletion Utilities/tire_parameters.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@ SLOPE_1 = 8
ADHESION = 250
X_MULT = 1.5
SLOPE_X = 1.4
M_CLAMP = 5
M_CLAMP = 5

[base_path]
path = "../ohyeah2389_modkart_class2/data"
front_tire_lat_file = "tire_kart_sprint_front_lat.lut"
front_tire_long_file = "tire_kart_sprint_front_long.lut"
rear_tire_lat_file = "tire_kart_sprint_rear_lat.lut"
rear_tire_long_file = "tire_kart_sprint_rear_long.lut"

[ranges]
by_twentys = 400
by_hundreds = 3000
by_fivehundreds = 40000
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.106
40000 | 0.106

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.3
;SLOPE_0 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.276
40000 | 0.276

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.3
;SLOPE_0 6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.506
40000 | 0.506

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.5
;SLOPE_0 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
39500 | 0.856
40000 | 0.856

;Generated on 2025-02-09 03:29:21 from the following parameters:
;Generated on 2025-02-12 13:21:26 from the following parameters:

;REF_M 1.5
;SLOPE_0 4
Expand Down

0 comments on commit 34b683f

Please sign in to comment.