Interfacing BeamNG.tech with MATLAB, two newly integrated sensors, NCAP testing and improved Python API.
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.
Furthermore, we added a new sensor into our autonomous sensor suit called advanced IMU sensor which provides readings at up to 2000Hz. It is a more advanced alternative, which will provide acceleration and gyroscopic measurements in a user-defined tri-axial local frame. The next sensor we worked on is a powertrain sensor. The powertrain sensor gives the BeamNGpy user direct access to all properties of a vehicle’s powertrain, such as eg. torques, steering, and all at a rate up to 2000Hz frequency. The data can be used in an ‘immediate mode,’ where it can be used real-time, or can be collected in bulk and processed later, such as for plotting graphs.
We have also added new scenarios for the Euro NCAP testing scenarios for automated vehicle systems in BeamNG.tech using the official BeamNG Python API. The NCAP scenarios are implemented to fit into user-defined vehicle setups. As such, you can define your own BeamNG.tech scenario in which to run the NCAP test and attach your own sensor models to the vehicle being tested.
Last but not least, we have smoothed out our Python API - BeamNGpy. For easier navigation we have modularized the BeamNGpy API and have added a lot of new functionality for vehicle and/or traffic control. As of now, all of BeamNGpy’s codebase is annotated with type hints. This provides better support for code editors and helps to reduce bugs caused by providing incompatible types to the public API functions.
As always, the BeamNG.tech v0.27 release includes all the cool features of the latest BeamNG.drive release which is our biggest release yet, so be sure to check it out!
Check the full report on BeamNG.drive v0.27
BeamNG.tech v027.1. Release Notes
We have deployed a hotfix inteded to resolve the issues reported after our latest major release.
Take a look at the latest bug fixes:
BeamNG.tech v027.1.
- converted all vehicle rotations sent to BeamNGpy to be consistent with each other
BeamNGpy 1.25.1
- fixed beamng.vehicles.replace to respect vehicle color and license plate text
BeamNG ROS Intergration 0.1.2.1
- fixed the break
Here is our changelog for 0.27.:
BeamNG - MATLAB Integration
Five main scripts were created:
1) Annotation and Bounding boxes:
- get semantic annotations
- get instance annotations
- draw bounding boxes (note that this feature is not ready for use yet)
2) Multi-shot Camera
- change the position and rotation of a camera
Object Placement
- define a custom scenario for a given map
- generate procedural content, i.e. simple meshes
Vehicle State Plotting
- use the state sensor to plot some graphs of the vehicle position, wheel speed and direction, throttle, and brake.
East Coast Random
- create a simple scenario
- use the simulator’s AI with BeamNGpy
Sensors
Advanced IMU sensor
- replaces the accelerometer sensor from last release.
- improves upon the existing IMU sensor by using a more advanced algorithm, and provides readings at up to 2000Hz.
- computation of new quantities as per an IMU sensor: rotational velocity, rotational acceleration, and mass.
- can be used in two modes: i) to send data immediately (as soon as it is computed) or ii) to send samples in bulk for a posteriori processing.
- introduction of a cutoff frequency to the smoothing of the sensor readings, as an alternative to providing the window size directly. both options now available.
- updates to test/demo scripts which use this sensor.
- minor bug fixes which were present in the accelerometer (the predecessor of this sensor) from last release
Powertrain sensor
- new sensor for analysing powertrain properties at high frequency (up to 2000Hz).
- can be used in two modes: i) to send data immediately (as soon as it is computed) or ii) to send samples in bulk for a posteriori processing.
- new test/demo scripts are available to show execution of this sensor.
BeamNG.tech´s Python API v0.25
NCAP tests
- upgrade AEB Car-to-Car rear scenarios
- new AEB Car-to-Car front turn across path scenario
- new simple trial controller to perform the test automatically through BeamNGpy
- possibility to perform tests controlling manually the VUT vehicle
- test scoring according to European standards
- boundary conditions evaluation
Modularized BeamNGpy API
- The functions on the BeamNGpy object are now split into modules for easier navigation:
- BeamNGpy.camera - configuring the in-game camera
- BeamNGpy.control - controlling the simulator state (pausing, stepping, quitting the simulator)
- BeamNGpy.debug - drawing debug objects
- BeamNGpy.env - controlling the environment state (time of day, gravity)
- BeamNGpy.scenario - loading/starting/stopping a BeamNG scenario
- BeamNGpy.settings - changing the simulator’s settings
- BeamNGpy.system - info about the host system
- BeamNGpy.traffic - controlling the traffic
- BeamNGpy.ui - controlling the GUI elements of the simulator
- BeamNGpy.vehicles - controlling vehicles
- Some of the functions on the Vehicle object are also moved into modules for easier navigation:
- Vehicle.ai - controlling the AI of the vehicle
- Vehicle.logging - controlling the in-game logging
- all the code examples and tests are rewritten to use the new, modular API
- the previous, not modularized API is still available for backwards compatibility reasons
New BeamNGpy functionality
- added support for a custom binary name in BeamNGpy constructor
- BeamNGpy.traffic.spawn to spawn traffic without a set of predefined vehicles
- BeamNGpy.traffic.reset to reset all traffic vehicles from the player (teleport them away).
- Vehicle.teleport now supports changing rotation without resetting the vehicle
- BeamNGpy.open now always tries to connect to already running simulator no matter the value of the launch argument
- Vehicle.switch, Vehicle.focus to switch the simulator’s focus to the selected vehicle
- BeamNGpy.vehicles.spawn now has a new argument connect to allow for not connecting the newly spawned vehicle to BeamNGpy
- Vehicle.recover to repair a vehicle and teleport it to a drivable position
- BeamNGpy.vehicles.replace to replace a vehicle with another one at the same position
- beamngpy.quat.quat_multiply utility function to multiply two quaternions
- optimized the Camera sensor decoding to be faster
- updated the required Python packages to newer versions
- Vehicle.set_license_plate to set a license plate text for a vehicle
- Vehicle.sensors.poll now allows also polling only a specified list of sensor names
- BeamNGpy.disconnect to disconnect from the simulator without closing it
- changed Camera sensor default parameters to not include annotation and depth data (for faster polling)
- added the optional steps_per_second parameter to BeamNGpy.settings.set_deterministic
- BeamNGpy.control.return_to_main_menu to exit the currently loaded scenario
- added the parameter quit_on_close to the BeamNGpy constructor. If set to False, BeamNGpy.close will keep the simulator running.
Bugfixes
- Vehicle.state[‘rotation’] now returns vehicle rotation consistent with the rest of the simulator. Previously, this rotation was rotated 180° around the Y axis.
- if you are using Vehicle.state[‘rotation’] in your existing scripts, you may need to flip it back for your intended use. You can use beamngpy.quat.quat_multiply((0, 0, 1, 0), <your_rotation>) for that purpose.
- flexmeshes are now properly updated when the simulator window is minimized
- fixed the issue with BeamNGpy scenarios sometimes resetting and not working properly after loading
- fixed Camera.extract_bounding_boxes not to crash on non-Windows systems
- fixed beamng.scenario.start() not working when the simulator was paused with beamng.control.pause() before
- fixed vehicle color and license plate text not being applied to dynamically spawned vehicles
BeamNGpy protocol
- added support out-of-order messages
Deprecations
- the remote argument of the BeamNGpy is not used anymore