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

BeamNG/BeamNG-MATLAB-integration

Repository files navigation

MATLAB Integration with BeamNG.tech

About

We are excited to announce that the highly requested feature of bridging BeamNG.tech and MATLAB is here. MATLAB, with its long history as an academic engineering and mathematical tool, is a programming and numeric computing platform used to analyse data, develop algorithms, and create models. The newly created bridge with MATLAB will enable you to run, control, and interact with the BeamNG.tech simulation. We have integrated five main scripts for your convenience in making use of annotations, bounding boxes, multi-shot camera, object placement, vehicle state plotting and creation of simple scenarios on our East Coast USA map.

Table of Contents

Documentation

Prerequirements

The BeamNG-MATLAB bridge is depending on BeamNG.Tech and BeamNGpy. Make sure that you have the license for BeamNG.Tech. The Github repository of the BeamNG-MATLAB has some basic examples of scripts that run a vehicle with some sensors ex. Lidar, Camera, and state sensor.

you must have the following softwares/packages installed

Setup

1. Setup a compatible python version

After installing the compatible python version with MATLAB, make sure to include the path of excutable python file (exe) in your in "path" variable of "environment variables" as explained here.

2. Run Python engine in MATLAB

Run the test_python.m to make sure that python engine is connected to your MATLAB engine as shown in the picture below.

Testing python in MATLAB

Getting Started

We have developed 5 fundamental scripts that showcase the versatility of using the MATLAB bridge to launch the Beamng.Tech simulator. These scripts demonstrate various capabilities such as utilizing sensors, creating scenarios, capturing screenshots from multiple viewpoints, analyzing movements, and visualizing sensors including lidar, depth camera, and AI driving for the vehicle.

The first script enables the use of sensors, such as lidar and depth camera, to gather data on the vehicle's surroundings. The second script allows for the creation of custom scenarios in the simulator, giving users complete control over the driving environment. The third script facilitates the capturing of screenshots from various angles, allowing for detailed analysis of the vehicle's performance.

The fourth script focuses on movement analysis, providing users with a detailed breakdown of the vehicle's movements and the forces acting on it. Finally, the fifth script provides a visualization of the vehicle's sensor data, including the ability to view the AI driving system in action. Overall, these 5 scripts demonstrate the powerful capabilities of the MATLAB bridge in conjunction with the Beamng.Tech simulator, offering users a comprehensive toolkit for advanced vehicle simulation and analysis.

1. Vehicle State Plotting

Use the state sensor to plot some graphs of the vehicle position, wheel speed and direction, throttle, and brake.

Vehicle state plotting

2. Running Lidar sensor, and AI control.

Create a simple scenario and use the simulator's AI with BeamNGpy.

Lidar sensor and AI control mode

3. Multi-shot Camera

Change the position and rotation of a camera.

Multi-shot Camera

4. Object Placement

Define a custom scenario for a given map and generate procedural content, i.e. simple meshes.

Object Placement

5. Annotation and Bounding Boxes

Get semantic annotations, instance annotations, and draw bounding boxes (note that this feature is not ready for use yet).

Annotation and Bounding Boxes

Compatibility

Running the BeamNG ROS integration requires three individual software components, here is a list of compatible versions.

BeamNG.tech BeamNGpy BeamNG-MATLAB-integration MATLAB Python
0.28 1.26 0.1.1 R2023a 3.9
0.27 1.25.1 0.1.0 R2022b 3.9

License

This project is licensed under the MIT License - see the LICENSE file for details.