BeamNGpy
BeamNGpy copied to clipboard
Won't load any Scenario just main menu
Hey, My problem is it don't want to load any scenario just opens the game and puts me in the main menu. Under Windows it works well but not on Ubuntu 20 Sometimes its give the loading screen, shows like everything loaded but nothing happens. BeamNG.drive is 0.29.1.0.0 (BeamNG.tech)
akkonut@local:~/BeamNGpy$ /home/akkonut/.pyenv/versions/3.11.4/bin/python /home/akkonut/BeamNGpy/examples/west_coast_radar.py
2023-10-03 00:45:19,607 |INFO |beamngpy |Started BeamNGpy logging.
2023-10-03 00:45:19,614 |WARNING |py.warnings |/home/akkonut/.pyenv/versions/3.11.4/lib/python3.11/site-packages/beamngpy/connection/connection.py:-1: ResourceWarning: unclosed <socket.socket fd=3, family=2, type=1, proto=0, laddr=('0.0.0.0', 32832)>
2023-10-03 00:45:19,614 |WARNING |py.warnings |/home/akkonut/.pyenv/versions/3.11.4/lib/python3.11/site-packages/beamngpy/connection/connection.py:-1: ResourceWarning: unclosed <socket.socket fd=3, family=2, type=1, proto=0, laddr=('0.0.0.0', 32832)>
2023-10-03 00:45:19,615 |INFO |beamngpy.BeamNGpy |Opening BeamNGpy instance.
2023-10-03 00:45:19,615 |INFO |beamngpy.BeamNGpy |Started BeamNG.
2023-10-03 00:45:29,615 |INFO |beamngpy.BeamNGpy |Connecting to BeamNG.tech at: (localhost, 64256)
2023-10-03 00:45:30,600 |INFO |beamngpy.BeamNGpy |Successfully connected to BeamNG.tech.
2023-10-03 00:45:30,600 |INFO |beamngpy.BeamNGpy |BeamNGpy successfully connected to BeamNG.
It's hangs at
>>> beamng.scenario.load(scenario)
Thanks!
Hi, are you using Ubuntu to run BeamNGpy and BeamNG.tech, or just BeamNGpy and the simulator is running on Windows?
I'm using BeamNGpy and BeamNG.tech on Ubuntu.
What is the version of BeamNGpy you are running on the Ubuntu host? There may be a mismatch, you should be running version 1.26.1 of the library.
I managed to run the feature_overview.ipynb
with BeamNG.tech 0.29.1.0 on an Ubuntu host, so it does not seem the problem is universal. You can also try to obtain debug logs of the communication, that may help with further diagnosis:
from beamngpy.logging import set_up_simple_logging
import logging
set_up_simple_logging(level=logging.DEBUG, log_communication=True)
...
bng.open()
...
If you can provide these debug logs, that may help the diagnosis.
Have a nice day,
I just found out gridmap is not avaiable anymore. Have to use smallgrid but gives no error for it like map not found.
scenario = Scenario('gridmap', 'RADAR_demo', description='Spanning the map with a RADAR sensor')
I tired to run my code but sadly Shared Memory still not available under Linux?
import time
from beamngpy import BeamNGpy, Scenario, Vehicle, set_up_simple_logging
from beamngpy.sensors import Camera
def main():
set_up_simple_logging()
beamng = BeamNGpy('localhost', 64256)
bng = beamng.open(launch=True)
scenario = Scenario('smallgrid', 'Camera demo', description='Camera stream test')
vehicle = Vehicle('ego_vehicle', model='etk800', license='RED', color='Red')
scenario.add_vehicle(vehicle)
scenario.make(bng)
bng.settings.set_deterministic(60) # Set simulator to 60hz temporal resolution
bng.scenario.load(scenario)
bng.ui.hide_hud()
bng.scenario.start()
# NOTE: Create sensor after scenario has started.
cam1 = Camera(
'camera1',
bng,
vehicle,
is_using_shared_memory=True,
pos=(-5, 0, 1),
dir=(1, 0, 0),
field_of_view_y=70,
is_render_annotations=False,
is_render_depth=False,
near_far_planes=(0.1, 1000),
resolution=(3840, 2160),
requested_update_time=0.05)
t_last = 0.0
for _ in range(10000):
time.sleep(0.015)
readings_data = cam1.poll()
t = time.time()
dt = t - t_last
t_last = t
print("time since last poll (s): ", dt)
cam1.remove()
bng.close()
if __name__ == '__main__':
main()
Tired to use without it.
Traceback (most recent call last):
File "/home/akkonut/BeamNGpy-1.26.1/examples/west_coast_radar.py", line 53, in <module>
main()
File "/home/akkonut/BeamNGpy-1.26.1/examples/west_coast_radar.py", line 26, in main
cam1 = Camera(
^^^^^^^
File "/home/akkonut/.pyenv/versions/3.11.4/lib/python3.11/site-packages/beamngpy/sensors/camera/camera.py", line 176, in __init__
self._open_camera(
File "/home/akkonut/.pyenv/versions/3.11.4/lib/python3.11/site-packages/beamngpy/sensors/camera/camera.py", line 610, in _open_camera
self.bng._send(data).ack('OpenedCamera')
File "/home/akkonut/.pyenv/versions/3.11.4/lib/python3.11/site-packages/beamngpy/connection/connection.py", line 275, in ack
message = self.recv()
^^^^^^^^^^^
File "/home/akkonut/.pyenv/versions/3.11.4/lib/python3.11/site-packages/beamngpy/connection/connection.py", line 269, in recv
raise message
beamngpy.logging.BNGValueError: This feature is not yet supported on Linux hosts.
Attach is not supported?
Thanks!
Hi, unfortunately, shared memory is still not supported on Linux hosts, the same holds for the Camera
sensor. It is on the roadmap, but it goes hand-in-hand with the stabilization of the Linux version as a whole.