`ultrasonicTest.lua`
> This Source Code Form is subject to the terms of the bCDDL, v. 1.1.
This Source Code Form is subject to the terms of the bCDDL, v. 1.1. If a copy of the bCDDL was not distributed with this file, You can obtain one at http://beamng.com/bCDDL-1.1.txt
Module variable: M
Hooks
onExtensionUnloadedonUpdateonVehicleDestroyed
Exported Functions
M.onExtensionUnloaded()
Line 260
Returns: M
M.executeUltrasonicTest()
Line 24
New Tests Added-------------------------- local function createUltrasonic(vehicleid) local args = {updateTime = --(float): How often the ultrasonic sensor should update its readings in the simulator (in seconds). updatePriority = --(float): A scheduling priority value for this ultrasonic sensor, in range 0 to 1. 0 is highest priority, 1 is least. pos = --(Point3F): The position of the ultrasonic sensor either in vehicle space (if attached to vehicle) or in world space (if fixed to the map). dir = --(Point3F): The forward direction in which the ultrasonic sensor points. up = --(Point3F): The up direction of the ultrasonic sensor. size = --(table): The horizontal and vertical resolution of the ultrasonic sensor. fovY = --(float): The vertical field of view of the ultrasonic sensor, in degrees. nearFarPlanes = --(table): The near and far plane distances of the ultrasonic sensor, in metres. rangeRoundness = --(float): The general roundness of the ultrasonic sensors range shape. Can be negative. rangeCutoffSensitivity = --(float): A cutoff sensitivity parameter for the ultrasonic sensor range-shape. rangeShape = --(float): The shape of the ultrasonic sensor range-shape in the range [0, 1], going from conical to spherical. rangeFocus = --(float): The focus parameter for the ultrasonic sensor range-shape. rangeMinCutoff = --(float): The minimum cut-off distance for the ultrasonic sensor range-shape. Nothing closer than this will be detected. rangeDirectMaxCutoff = --(float): The maximum cut-off distance for the ultrasonic sensor range-shape. This parameter is a hard cutoff - nothing further than this will be detected, although other parameters can also control the maximum distance. sensitivity = --(float): The sensitivity of the ultrasonic sensor detection. fixedWindowSize = --(float): Used with sensitivity to set how sharply the ultrasonic sensor detects surfaces. isVisualised = --(bool): A flag which indicates if the ultrasonic sensor should be visualised. isStatic = --(bool): True if the ultrasonic sensor is fixed to a point on the map, false if it is attached to a vehicle. isSnappingDesired = --(bool): True if the ultrasonic sensor position should be forced onto the surface of the vehicle, at its closest vehicle point. This is useful if finding it hard to have the ultrasonic sensor on the vehicle itself. False, otherwise, eg if the ultrasonic sensor should be suspended at a fixed point relative to the vehicle. isForceInsideTriangle = --(bool): Used with isSnappingDesired. True, if the ultrasonic sensor should be forced to be inside its nearest vehicle triangle. Otherwise false. } local ultrasonicID = extensions.tech_sensors.createUltrasonic(vehicleid,args) end Public interface.
M.onUpdate(dtReal, dtSim, dtRaw)
Line 181
Trigger execution to access the ultrasonic test class in every update cycle.
M.onVehicleDestroyed(vid)
Line 198
If a vehicle is destroyed, remove any attached sensors.
Exported Variables
M.onExtensionLoaded
Line 259 - onExtensionUnloaded
M.createUltrasonic
Line 261 - createUltrasonic
Internal Functions
Show internal functions
executeUltrasonicTest()(line 24)The ultrasonic test.
onUpdate(dtReal, dtSim, dtRaw)(line 181)Trigger execution to access the ultrasonic test class in every update cycle.
onVehicleDestroyed(vid)(line 198)If a vehicle is destroyed, remove any attached sensors.
onExtensionLoaded()(line 203)