How beamng/beamngpy works
BeamNGpy is a Python client for remotely controlling BeamNG.tech. The main workflow is to connect to or launch the simulator, define and write a scenario, load and start it, then control vehicles and collect simulated sensor data. The library also exposes simulator-wide APIs, road and scene geometry, and data-conversion tools. Several links reflect the README workflow; unsampled API modules are grouped by their documented purpose rather than given speculative call relationships.
Main entry points: scenario.py Scenario Definition · beamng.py BeamNG Client · vehicle.py Vehicle Model · connection.py Socket Transport
Components 25
Connection and Runtime
- BeamNG Client
src/beamngpy/beamng/beamng.py - Socket Transport
src/beamngpy/connection/connection.py - Logging
src/beamngpy/logging.py
Scenarios and Scene
- Scenario Definition
src/beamngpy/scenario/scenario.py - Level Data
src/beamngpy/scenario/level.py - Road Geometry
src/beamngpy/scenario/road.py - Scene Objects
src/beamngpy/scenario/scenario_object.py - Procedural Objects
src/beamngpy/scenario/procedural.py - Prefab Serialization
src/beamngpy/utils/prefab.py - Vector Math
src/beamngpy/misc/vec3.py - Quaternion Math
src/beamngpy/misc/quat.py - Color Utilities
src/beamngpy/misc/colors.py
Simulation Control
- Vehicle Model
src/beamngpy/vehicle/vehicle.py - Vehicle APIs
src/beamngpy/api/vehicle - Scenario API
src/beamngpy/api/beamng/scenario.py - Simulator APIs
src/beamngpy/api/beamng
Sensors and Data
- Vehicle Sensors
src/beamngpy/vehicle/sensors.py - Camera Sensor
src/beamngpy/sensors/camera/camera.py - Lidar Sensor
src/beamngpy/sensors/lidar.py - Radar Sensor
src/beamngpy/sensors/radar.py - Vehicle Feeder
src/beamngpy/sensors/vehicle_feeder.py - Other Sensor Models
src/beamngpy/sensors
Interchange Tools
- Format Conversion
src/beamngpy/tools
Other components
- Python User
- BeamNG.tech
Connections 29
- Python User → BeamNG Client: opens or connects
README.md - BeamNG Client → BeamNG.tech: launches or connects
README.md - BeamNG Client → Socket Transport: creates connection
src/beamngpy/beamng/beamng.py - Socket Transport → BeamNG.tech: exchanges messages
README.md - Python User → Scenario Definition: defines scenario
README.md - Scenario Definition → BeamNG Client: writes scenario
README.md - BeamNG Client → Scenario API: exposes scenario API
src/beamngpy/beamng/beamng.py - Scenario API → BeamNG.tech: loads and starts
README.md - Scenario Definition → Vehicle Model: adds vehicle
src/beamngpy/scenario/scenario.py - Scenario Definition → Road Geometry: encodes roads
src/beamngpy/scenario/scenario.py - Scenario Definition → Scene Objects: stores objects
src/beamngpy/scenario/scenario.py - Scenario Definition → Procedural Objects: stores procedural meshes
src/beamngpy/scenario/scenario.py - Scenario Definition → Level Data: uses level data
src/beamngpy/scenario/scenario.py - Scenario Definition → Prefab Serialization: serializes scene
src/beamngpy/scenario/scenario.py - Vehicle Model → Vehicle APIs: initializes APIs
src/beamngpy/vehicle/vehicle.py - Vehicle Model → Vehicle Sensors: attaches sensors
src/beamngpy/vehicle/vehicle.py - Vehicle Model → Socket Transport: connects vehicle
src/beamngpy/vehicle/vehicle.py - Python User → Vehicle APIs: controls vehicle
README.md - Vehicle APIs → BeamNG.tech: sends control commands
README.md - Python User → Simulator APIs: uses simulator features
README.md - Vehicle Sensors → Camera Sensor: supports camera
- Python User → Camera Sensor: configures sensor
README.md - Python User → Lidar Sensor: configures sensor
README.md - Python User → Other Sensor Models: configures sensor
README.md - Vehicle Feeder → Socket Transport: uses communication
src/beamngpy/sensors/vehicle_feeder.py - Road Geometry → Scene Objects: uses road objects
src/beamngpy/scenario/road.py - Road Geometry → Prefab Serialization: uses serialization
src/beamngpy/scenario/road.py - Procedural Objects → BeamNG.tech: places objects
src/beamngpy/scenario/procedural.py - Python User → Format Conversion: imports or exports