Skip to content

BeamNG/beamng-ros-integration

Repository files navigation

BeamNG ROS Integration

About

This repository contains packages to support the interoperability between BeamNG.tech and ROS. BeamNG.tech is a driving simulation platform, suitable for commercial and academic use. Free licenses are available for non-commercial and academic use. Inquiries can be made through our registration form. For inquiries regarding commercial use, contact us at licensing@beamng.com.

Table of Contents

Documentation

Features

As of now the BeamNG ROS integration supports one package for the remote control of the simulation platform and one package for the control of a driving agent. A third package manages custom messages.

Prerequirements

For using the BeamNG ROS integration, a BeamNG.tech build and a python environment with BeamNGpy installed are required.

Note that BeamNG.tech only runs on Window, although Linux support is on its way. That means that BeamNG.tech needs to run on a separate Windows machine, or that ROS needs to run on on WSL.

The BeamNG ROS integration is compatible with the ROS 1 distributions Melodic Morenia and Noetic Ninjemys.

Getting Started

To use this project, a basic knowledge of the BeamNG.tech simulator and the BeamNGpy is neccessary. We recommend to familiarize yourself first with BeamNGpy to get a basic understanding of the platform before using the BeamNG ROS Integration.

After setting up BeamNG.tech and BeamNGpy with a python environment, the simulation needs to be started through BeamNGpy or through the excutable file exe.

Method 1: Using beamngpy

To start the simulator via Python and beamngpy, follow these steps - Open your command prompt. - Execute the following Python code:

from beamngpy import BeamNGpy, Scenario, Vehicle
bng = BeamNGpy('localhost', 64256)  # Initialize the BeamNGpy instance to connect to the simulator
bng.open(listen_ip='*')  # Open the simulator with an open listening IP

This method initializes the BeamNGpy instance, connecting to the BeamNG.Tech simulator, and then opens the simulator to listen for incoming connections.

Method 2: Using Command Prompt

Alternatively, you can start the simulator directly from the command prompt: - Open your command prompt. - Navigate to your simulator's directory. - Paste and execute the following command

Bin64\BeamNG.tech.x64.exe -rport 64256 -nosteam -lua registerCoreModule('tech/techCore')

The ROS packages from this repository need to be added and build in your catkin workspace. See the ROS tutorials for more information on how to set up a catkin workspace.

A node connecting ROS to the simulation can then be started with the help of the control.launch file in the beamng_control package through the command:

roslaunch beamng_control control.launch

It needs to be configured to contain the correct IP address of the machine hosting the simulation. Using it will start up a node that connects to the simulation and starts up a scenario as defined in the beamng_control/config/simple_scenario.json. Other scenario specifications are available in the same directory.

ROS Demo GIF

Compatibility

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

BeamNG.tech BeamNGpy BeamNG ROS Integration
0.31 1.28 0.4.1
0.30 1.27.1 0.4
0.29 1.26.1 0.3
0.28 1.26 0.2.1
0.27 1.25.1 0.2
0.26 1.24 0.1.1
0.25 1.23.1 0.1

Troubleshooting

This section lists common issues with BeamNG ROS Integration in particular. Since this library is closely tied to BeamNG.tech and thus BeamNG.drive, it is also recommended to consult the documentation on BeamNG.drive here:

https://documentation.beamng.com/

Contributions

We always welcome user contributions, be sure to check out our contribution guidelines first, before starting your work.