initSecondStage
Definition
-- @/lua/vehicle/input.lua:143
local function initSecondStage()
--scale rates based on steering wheel degrees
local foundSteeringHydro = false
if hydros then
for _, h in pairs(hydros.hydros) do
if h.inputSource == "steering_input" then --check if it's a steering hydro
foundSteeringHydro = true
if h.steeringWheelLock then
vehicleSteeringWheelLock = abs(h.steeringWheelLock)
break
end
end
end
for _, h in pairs(hydros.hydros) do
if h.inputSource == "steering_input" then
if type(h.steeringAutocenterEnabled) == "boolean" then
steeringAutocenterEnabled = h.steeringAutocenterEnabled
break
end
end
end
for _, h in pairs(hydros.hydros) do
if h.inputSource == "steering_input" then
if type(h.lowspeedCoefFFB) == "boolean" then
M.lowspeedCoefFFB = h.lowspeedCoefFFB
break
end
end
end
end
if v.data.input and v.data.input.steeringWheelLock ~= nil then
vehicleSteeringWheelLock = v.data.input.steeringWheelLock
elseif foundSteeringHydro then
if v.data.input == nil then
v.data.input = {}
end
v.data.input.steeringWheelLock = vehicleSteeringWheelLock
end
for wi, wd in pairs(wheels.wheels) do
if wd.parkingTorque and wd.parkingTorque > 0 then
handbrakeSoundEngaging = handbrakeSoundEngaging or sounds.createSoundscapeSound("handbrakeEngaging")
handbrakeSoundDisengaging = handbrakeSoundDisengaging or sounds.createSoundscapeSound("handbrakeDisengaging")
handbrakeSoundDisengaged = handbrakeSoundDisengaged or sounds.createSoundscapeSound("handbrakeDisengaged")
break
end
end
-- identify and cache which are the front wheels
table.clear(frontWheels)
local debug = false
for wi1, wd1 in pairs(wheels.wheels) do
local long1, side1 = getLongitudinalLateralPrefix(wd1.name)
if debug then
print(string.format("----- '%s' = %s, %s", wd1.name, long1, side1))
end
if long1 == "F" then -- this is a front wheel
local rearWheels = {}
for wi2, wd2 in pairs(wheels.wheels) do
local long2, side2 = getLongitudinalLateralPrefix(wd2.name)
if long2 == "R" then -- this is a rear wheel
if side1 == nil then -- we don't know the side of front wheel (maybe it's a 3-wheel pigeon)
table.insert(rearWheels, wi2)
if debug then
print(string.format(" * '%s' = %s, %s", wd2.name, long2, side2))
end
elseif side1 == side2 then -- this rear wheel is from the same side
table.insert(rearWheels, wi2)
if debug then
print(string.format(" - '%s' = %s, %s", wd2.name, long2, side2))
end
end
end
end
if foundSteeringHydro and not next(rearWheels) then
log("W", "", "Unable to identify any rear wheels for front wheel: "..dumps(wd1.name))
end
table.insert(frontWheels, {wi1, wd1, rearWheels, #rearWheels})
end
end
if foundSteeringHydro and not next(frontWheels) then
log("W", "", "Unable to identify any front wheels: driving assistants may not work")
end
if debug then
for k, v in ipairs(frontWheels) do
local namef = wheels.wheels[v[1]].name
local namesr = {}
for l, w in ipairs(v[3]) do
table.insert(namesr, wheels.wheels[w].name)
end
print(string.format("front wheel '%s' has these rear wheels: %s", namef, dumps(namesr)))
end
end
rateMult = 5 / 8
if vehicleSteeringWheelLock ~= 1 then
rateMult = 450 / vehicleSteeringWheelLock
end
kbdOutRateMult = min(kbdOutRate * rateMult, 2.68)
kbdInRateMult = min(kbdInRate * rateMult, 3.68)
padSmoother = newTemporalSmoothing()
kbdSmoother = newTemporalSmoothing()
M.reset()
end
Callers
@/lua/vehicle/controller/gauges/analogOdometer.lua
local function initSecondStage(jbeamData)
--merge config data from multiple parts so that some things can be defined in sub-parts. section name needs to be "configuration_xyz"
@/lua/vehicle/wheels.lua
local function initSecondStage()
if not v.data.refNodes or not v.data.nodes or not v.data.nodes[v.data.refNodes[0].ref] then
@/lua/vehicle/controller/drivingDynamics/supervisors/yawControl.lua
local function initSecondStage(jbeamData)
electrics.values.hasESC = true
@/lua/vehicle/controller/drivingDynamics/supervisors/tractionControl.lua
local function initSecondStage(jbeamData)
tractionControlledWheelGroups = {}
@/lua/vehicle/controller/drivingDynamics/supervisors/components/awdControl.lua
local function initSecondStage(jbeamData)
local awdActuatorName = jbeamData.awdActuatorName or "electronicSplitShaftLock"
@/lua/vehicle/controller/tirePressureControl.lua
local function initSecondStage(jbeamData)
local mode = jbeamData.mode or "manualControl"
@/lua/vehicle/controller/drivingDynamics/sensors/vehicleData.lua
local function initSecondStage(jbeamData)
M.isActive = false
@/lua/vehicle/controller.lua
if c.initSecondStage then
c.initSecondStage(controllerJbeamData[controller.name])
end
local function initSecondStage()
for _, v in pairs(sortedControllers) do
if v.initSecondStage then
v.initSecondStage(controllerJbeamData[v.name])
end
elseif v.initSecondStage then
v.initSecondStage(controllerJbeamData[v.name])
end
@/lua/vehicle/controller/drivingDynamics/CMU.lua
local function initSecondStage()
subControllerLookup = {}
@/lua/vehicle/controller/drivingDynamics/actuators/activeCenterDiffLock.lua
local function initSecondStage(jbeamData)
if not CMU then
@/lua/vehicle/controller/gauges/genericGauges.lua
local function initSecondStage(jbeamData)
local displayData = jbeamData.displayData
@/lua/vehicle/controller/drivingDynamics/supervisors/yawProviders/STMEstimate.lua
local function initSecondStage(jbeamData)
local yawControl = CMU.getSupervisor("yawControl")
@/lua/vehicle/main.lua
profilerPushEvent("3.3 init - second stage")
wheels.initSecondStage()
controller.initSecondStage()
wheels.initSecondStage()
controller.initSecondStage()
drivetrain.init()
props.init()
input.initSecondStage() -- needs to go after sounds & electrics
recovery.init()
@/lua/vehicle/controller/drivingDynamics/supervisors/slipProviders/virtualSpeedSlip.lua
local function initSecondStage(jbeamData)
local tractionControl = CMU.getSupervisor("tractionControl")
@/lua/vehicle/controller/drivingDynamics/actuators/electronicDiffLock.lua
local function initSecondStage(jbeamData)
if not CMU then
@/lua/vehicle/controller/esc.lua
local function initSecondStage()
escPulse = 0
@/lua/vehicle/controller/drivingDynamics/actuators/activeDiffLock.lua
local function initSecondStage(jbeamData)
if not CMU then
@/lua/vehicle/controller/drivingDynamics/supervisors/components/motorTorqueControl.lua
local function initSecondStage(jbeamData)
local useForTractionControl = jbeamData.useForTractionControl == nil and true or jbeamData.useForTractionControl
@/lua/vehicle/controller/controllerTemplate.lua
-- local function initSecondStage(jbeamData)
-- end
@/lua/vehicle/controller/drivingDynamics/supervisors/components/brakeControl.lua
local function initSecondStage(jbeamData)
--todo create jbeam param to determine if component should be used as TC or ESC component
@/lua/vehicle/controller/drivingDynamics/actuators/electronicSplitShaftLock.lua
local function initSecondStage(jbeamData)
if not CMU then
@/lua/vehicle/controller/pneumatics/autoLevelSuspension.lua
local function initSecondStage(jbeamData)
local actuatorName = jbeamData.actuatorName or "airbags"
@/lua/vehicle/controller/drivingDynamics/supervisors/components/diffControl.lua
local function initSecondStage(jbeamData)
local frontDiffName = jbeamData.frontDiffName or "lockFront"
@/lua/vehicle/controller/drivingDynamics/actuators/activeDiffBias.lua
local function initSecondStage(jbeamData)
if not CMU then
@/lua/vehicle/controller/drivingDynamics/supervisors/components/aeroControl.lua
local function initSecondStage(jbeamData)
local yawControl = CMU.getSupervisor("yawControl")