Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Latest commit

 

History

History
35 lines (24 loc) · 2.05 KB

README.md

File metadata and controls

35 lines (24 loc) · 2.05 KB

This repository is deprecated, the MQTT integration is included with BeamNG.tech builds, documentation available at https://documentation.beamng.com/beamng_tech/mqtt/.


BeamNG MQTT Integration

MQTT is a lightweight publish/subscribe messaging protocol for the Internet of Things (IoT). This repository provides an integration of the protocol to BeamNG.tech, allowing sending of data from BeamNG to a MQTT broker.

This repository consists of a sample vehicle controller exporting the data from BeamNG to a MQTT broker with help of the included luamqtt library with minor edits to be compatible with the BeamNG codebase.

Recommended Setup

  1. If you are not using your own MQTT broker, you can test with the example one provided in the tools/ folder. In this case, follow the instructions in the subfolder first.

  2. Clone this repository.

  3. Copy over the mqtt-integration folder to the unpacked subfolder of your mods folder (if it does not exist, create it). You can find the folder by running BeamNG, going to the Mods menu, and then clicking the Open Mod folder button.

    The default location is %localappdata%\BeamNG.drive\<VERSION>\mods\unpacked.

  4. Restart the simulator. You should see that the mqtt-integration mod is now installed.

  5. Spawn a car you want to send the data for, open the BeamNG console (by pressing `) and switch to BeamNG - Current Vehicle in the bottom-left combobox.

  6. Write:

    controller.loadControllerExternal('tech/MQTToutput', 'MQTToutput', {uri = '127.0.0.1', topic='car_data'})

    into the console to start exporting data. If you are using the example broker, you should see that data are being sent.

  7. To stop, use the same console to execute the following command:

    controller.unloadControllerExternal('MQTToutput')

Customization

To add more data to the MQTT output, edit MQTToutput.lua. The function of interest is updateData.