Guides
BeamNG Control
This guide describes the feature set of the beamng_control package. It connects ROS to the BeamNG.tech simulation platform and converts sensor information into ROS and, where appropriate, Rviz compatible ROS messages.
Starting the Node
To start the node a running instance of BeamNG.tech is needed that has been started through the BeamNGpy library. A list of compatible versions can be found on the home page or in the README.md.
Defining Scenarios
The BeamNG ROS Integration supports JSON-based scenario definition.
Example files can be found in the beamng_control/config/scenarios/
directory.
General Setup
Scenarios are defined through JSON objects, here is a list of possible keys and values.
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
BeamnG ROS Integration version, f.ex. |
Mandatory |
|
String |
BeamNG.tech level name, f.ex. |
Mandatory |
|
String |
Value |
Optional |
|
Array |
At least one vehicle needs to be specified in order to obtain a valid scenario. See the table below for the Specification. |
Mandatory |
|
String |
Name of the level. |
Mandatory |
|
Float |
Value between |
Optional |
|
String |
Weather presets are level specific, ToDo |
Optional |
Vehicle Definition
Vehicles are also defined as JSON objects.
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
Name of the vehicle, used for identification |
Mandatory |
|
String |
Name of the vehicle type, f.ex. |
Mandatory |
|
Array |
Array of 3 floats, specifying the |
Mandatory |
|
Array |
Array of 4 floats, specifying the vehicle rotation quaternion. |
Mandatory |
|
Array |
Array of JSON objects, specifying the vehicles sensor parameters. |
Optional |
Sensor Definition
Sensors are also defined with the help of JSON objects.
To avoid redundancy, the sensor definition of complex sensors has been split into two parts, where the default values are stored in an extra JSON file.
Default values can be overridden by adding them to the JSON object with a new value.
All sensors automatically publish their data to the topic /beamng_control/<vehicle name>/<unique_sensor_id>
.
Damage Sensor
Message type: beamng_msgs.msg.DamagSensor
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
|
Mandatory |
|
String |
Unique sensor id. |
Mandatory |
Timer
Message type: beamng_msgs.msg.TimeSensor
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
|
Mandatory |
|
String |
Unique sensor id. |
Mandatory |
GForces
Message type: beamng_msgs.msg.GForceSensor
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
|
Mandatory |
|
String |
Unique sensor id. |
Mandatory |
Electrics
Message type: beamng_msgs.msg.ElectricsSensor
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
|
Mandatory |
|
String |
Unique sensor id. |
Mandatory |
Camera
Contrary to other sensors, the Camera sensor may publish to multiple topics. If the camera sensor is configured to collect color, depth, annotation, and instance data, it is published to the respective topics:
/beamng_control/<vehicle_id>/<camera_id>/color
/beamng_control/<vehicle_id>/<camera_id>/depth
/beamng_control/<vehicle_id>/<camera_id>/annotation
/beamng_control/<vehicle_id>/<camera_id>/instance
The message type for all topics is sensor_msgs.msg.Image
.
Note that although the bounding_box option is given, this feature is still under development and will automatically be disabled.
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
|
Mandatory |
|
String |
Unique sensor id. |
Mandatory |
|
Array |
Array of 3 floats, specifying the |
Mandatory |
|
Array |
Array of 4 floats, specifying the vehicle rotation quaternion |
Mandatory |
|
Array |
Tuple of ints, defining the |
Optional |
|
Integer |
Camera field of view. |
Optional |
|
Boolean |
Dis-/Enables color image generation. |
Optional |
|
Boolean |
Dis-/Enables depth image generation. |
Optional |
|
Boolean |
Dis-/Enables ground truth generation for object type annotation. |
Optional |
|
Boolean |
Dis-/Enables ground truth generation for instance annotation. |
Optional |
|
Boolean |
This feature is not supoprted at the moment and will be automatically disabled. |
Optional |
Lidar
Message type: sensor_msgs.msg.PointCloud2
Key |
Value Type |
Value Specification |
Entry Type |
---|---|---|---|
|
String |
|
Mandatory |
|
String |
Unique sensor id. |
Mandatory |
|
Integer |
Vertical sensor resolution. |
Mandatory |
|
Float |
Vertical angle. |
Mandatory |
|
Integer |
Laser frequency. |
Mandatory |
|
Integer |
Mandatory |
|
|
Integer |
Maximal distance for data collection. |
Mandatory |
|
Integer |
Dis-/Enable in-simulation Lidar visualization. |
Mandatory |
Controlling the Simulation
Various services to control the state of the simulation are available.
Name |
Type |
Purpose |
---|---|---|
|
|
Determining the current state of the scenario. |
|
|
Starting a loaded scenario. |
|
|
Pause the simulation. |
|
|
Resume the simulation. |
While the simulation is paused, it can be advanced a given amount of steps through the action server:
Name |
Type |
Purpose |
---|---|---|
|
|
Determining the current state of the scenario. |
Vehicle Creation and Control
Name |
Type |
Purpose |
---|---|---|
|
|
Get list of spawned vehicles. |
|
|
Spawn new vehicle. |
|
|
Teleport vehicle. |
BeamNG Agent Control
This guide documents the feature set of the beamng_agent package. Its main purpose is to provide an interface to steer individual vehicles.
Starting the Node
For starting the node a running instance of BeamNG.tech is needed
that has been started through the BeamNGpy library.
Then a beamng_control
node needs to be launched to start a scenario of your choice.
After adjusting its parameter, the node can then be run by typing roslaunch beamng_agent example.launch
.
Vehicle Control
The node establishes a connection to an already spawned vehicle in the simulation and subscribes to the
beamng_agent/<vehicle_id>/control
topic with message type beamng_msgs.msg.VehicleControl
.
Field |
Type |
Definition |
---|---|---|
steering |
|
Rotation of the steering wheel, from -1.0 to 1.0. |
throttle |
|
Intensity of the throttle, from 0.0 to 1.0. |
brake |
|
Intensity of the brake, from 0.0 to 1.0. |
parkingbrake |
|
Intensity of the parkingbrake, from 0.0 to 1.0. |
clutch |
|
Clutch level, from 0.0 to 1.0. |
gear |
|
Gear index, -1 equals backwards, 0 equals neutral, 1 to X equals Nth gear. |