From 8c9b7377a6fd674bcc5d13c33c762893a850685a Mon Sep 17 00:00:00 2001 From: DanielRhee Date: Thu, 8 Jan 2026 12:24:46 -0800 Subject: [PATCH 1/2] ackermann --- FullVehicleSim/Mech/steering.py | 13 +++++++++++++ FullVehicleSim/params.json | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/FullVehicleSim/Mech/steering.py b/FullVehicleSim/Mech/steering.py index be30430..11e1394 100644 --- a/FullVehicleSim/Mech/steering.py +++ b/FullVehicleSim/Mech/steering.py @@ -57,6 +57,19 @@ def calculateVirtualSlipAngle(parameters): # # return (Fy / CF) * (1 + term1Num/Term1Denom + term2Num/term2Denom + term3) +# Returns a tuple with (in, out) steering angle +def calculateAckermann(steerAngle, aPercent): + # We can assume that front and rear slip angles evolve identically in the small step steer so delta = l/r + wheelBase = params["wheelBase"] + turnRadius = wheelBase / steerAngle + + innerRadiusWheel = np.arctan(wheelBase/(turnRadius - params["trackWidthAvg"])) + outerRadiusWheel = np.arctan(wheelBase/(turnRadius + params["trackWidthAvg"])) + + return (np.degrees(innerRadiusWheel), np.degrees(outerRadiusWheel)) + + + def calculateYawRate(currYawRate, speed, stepSteerInput, timeSinceLastSteer, frontCorneringStiffnessDeg_, rearCorneringStiffnessDeg_, parameters): # This model is based on Performance Vehicle Dynamics # It is a pretty meh model which uses euler's method to approximate transient behavior diff --git a/FullVehicleSim/params.json b/FullVehicleSim/params.json index 2348565..4e8e229 100644 --- a/FullVehicleSim/params.json +++ b/FullVehicleSim/params.json @@ -14,7 +14,8 @@ "tractiveIMax": 300, "Mass": 300, - "wheelBase": 1.65471, + "wheelBase": 1.5898989, + "trackWidthAvg": 1210.004, "a": 0.853506, "frontWeightDist": 46.46, "CoG-height": 0.999628, From 8ffe3235718f66d7762b78eea4b0a1ce78aa3d8b Mon Sep 17 00:00:00 2001 From: DanielRhee Date: Thu, 8 Jan 2026 12:35:29 -0800 Subject: [PATCH 2/2] initial --- VDCalculators/README.md | 3 +++ VDCalculators/ackermannOptimizer.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 VDCalculators/ackermannOptimizer.py diff --git a/VDCalculators/README.md b/VDCalculators/README.md index 3274aca..5c92de9 100644 --- a/VDCalculators/README.md +++ b/VDCalculators/README.md @@ -1 +1,4 @@ Calculators that are not to be integrated into the full Vehicle Dynamics model. + +# Ackermann optimizer +This calculator aims to optimize the ackermann percentages of FS4 diff --git a/VDCalculators/ackermannOptimizer.py b/VDCalculators/ackermannOptimizer.py new file mode 100644 index 0000000..5ed2435 --- /dev/null +++ b/VDCalculators/ackermannOptimizer.py @@ -0,0 +1,14 @@ +import os +import sys +import json +sys.path.append("../FullVehicleSim/Mech") +from steering import * + +import json +magic:dict +parameters:dict +with open('../FullVehicleSim/params.json', 'r') as file: + params = json.load(file) + Magic = params["Magic"] + Parameters = params["Parameters"] + del params