Hi there!
I was trying to launch a platoon with two vehicles, and I received an error that was hard to debug. I’m running BeamNG in a Docker container with headless mode and connecting to it using BeamNGpy. My Python scripts fail when launching the platoon. Here is the code:
beamng = BeamNGpy(host="127.0.0.1", port=25252)
beamng.open()
scenario = Scenario("west_coast_usa", "vehicle logging")
vehicle1 = Vehicle("leader_vehicle", model="sbr", license="LAINF_1")
vehicle2 = Vehicle("electric_vehicle", model="pickup", license="LAINF_2", part_config='vehicles/sbr/electric_300.pc')
electrics = Electrics()
vehApi = VehiclesApi(beamng)
trafficApi = TrafficApi(beamng)
platoonApi = PlatoonApi(beamng)
platoonApi.launch_platoon(leader=vehicle1, mode="traffic", speed=20, debug=True)
platoonApi.join(leader=vehicle1, veh=vehicle2, speed=20, debug=True)
When I run the script, it fails with the following error:
Traceback (most recent call last):
File "/opt/BeamNG/BeamNG.tech.v0.36.4.0/testes/explore_vehicle.py", line 212, in <module>
main()
File "/opt/BeamNG/BeamNG.tech.v0.36.4.0/testes/explore_vehicle.py", line 55, in main
platoonApi.launch_platoon(leader=vehicle1, mode="traffic", speed=20, debug=True)
File "/opt/BeamNG/BeamNG.tech.v0.36.4.0/testes/venv/lib/python3.10/site-packages/beamngpy/api/beamng/platoon.py", line 70, in launch_platoon
self._send(data).ack("platoonLaunched")
File "/opt/BeamNG/BeamNG.tech.v0.36.4.0/testes/venv/lib/python3.10/site-packages/beamngpy/connection/connection.py", line 288, in ack
message = self.recv()
File "/opt/BeamNG/BeamNG.tech.v0.36.4.0/testes/venv/lib/python3.10/site-packages/beamngpy/connection/connection.py", line 280, in recv
raise message
beamngpy.logging.BNGError: The request was not handled by BeamNG.tech. This can mean:
- an incompatible version of BeamNG.tech/BeamNGpy
- an internal error in BeamNG.tech
- incorrectly implemented custom command
The container logs do not contain any information related to this error. Here are the last lines of the log:
2.73646|D|GELua.core_modmanager.initDB| Notification : took 61.887923ms to callback
2.73984|D|GELua.gameplay_rawPois.| Raw Poi Lists Cleared. New Generation: 7
2.74001|W|GELua.core_hardwareinfo.core_hwinfo| No desktop entry found. To get a BeamNG entry and (optionally) support for the beamng:// URL scheme, please run the script BinLinux/BeamNG_install_desktop_file.sh.
2.75418|I|GELua.adas_gauge_light.modscript| adas_gauge_light loaded (BeamNG.tech)
2.94919|D|GELua._lua_ge_extensions_gameplay_missions_proceduralMissionGenerators_timeTrialMissions.| Hid 0 prodecural TimeTrials missions because they were hidden by real missions.
2.94979|D|GELua.gameplay_missions_missions.| Loaded 548 total missions: 511 from files, 37 from generators.
3.22707|D|GELua.gameplay_missions_unlocks.| Processed unlock status of missions: 428/548 startable missions, 425/548 visible missions.
3.55064|D|GELua.core_cameraModes_relative.core_camera.relative| No refNodes found, using default fallback
3.58595|E|addBinding| Could not create a description for binding keyboard0::*
3.58733|D|GELua.core_input_bindings.bindings| Loaded 298 bindings for device keyboard0
3.58784|D|GELua.core_input_bindings.bindings| Loaded 20 bindings for device mouse0
21.97896|I|GELua.tech_techCore.TechGE| Accepted new client: 127.0.0.1/46848
22.16230|E|GELua.TechCom| Error reading from socket: closed
22.16235|E|GELua.TechCom| Error reading from socket: tcp{client}: 0x711aa3dded08 - closed
Can anyone help?