Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions FullVehicleSim/Mech/steering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion FullVehicleSim/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions VDCalculators/README.md
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions VDCalculators/ackermannOptimizer.py
Original file line number Diff line number Diff line change
@@ -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