The 4wd controller enables you to connect and disconnect a driveshaft and allows you to control a rangebox. The configuration needs to provide the correct powertrain device names (shaft and rangeBox) for it to work.

You can also use multiple 4wd controllers at once if desired, each one controlling a different set of devices.

File Info

Filename 4wd.lua
Path /lua/vehicle/controller/4wd.lua
Type Auxiliary
Multiple Usage Supported

Jbeam Properties

Name Default Unit Description
shaftName nil string The name of the disconnecting shaft
rangeBoxName nil string The name of the rangebox device to be controlled

Public Functions

Function name Parameters Description
toggle4WD()   Toggles between 2WD and 4WD
set4WDMode(mode) string Sets the 4WD mode to either “connected” or “disconnected”
toggleRange()   Toggles between High and Low range
setRangeMode(mode) string Sets the range to either “high” or “low”

Example Usage

"controller": [
"4wd": {