Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Name levels directory based on the BeamNG version #117

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion code_pipeline/beamng_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,21 @@ def _run_simulation(self, the_test) -> SimulationData:

# Override default configuration passed via ENV or hardcoded
if self.beamng_user is not None:
# Parse BeamNG version
version = '0.24'
directory = self.beamng_user
if '/' in self.beamng_user:
directory = self.beamng_user.split('/')[-1]
prefix = 'BeamNG.tech.v'
if directory.startswith(prefix):
v = directory[len(prefix):len(prefix) + 4]
try:
float(v)
version = v
except:
pass
# Note This changed since BeamNG.research
beamng_levels = LevelsFolder(os.path.join(self.beamng_user, '0.24', 'levels'))
beamng_levels = LevelsFolder(os.path.join(self.beamng_user, version, 'levels'))
maps.beamng_levels = beamng_levels
maps.beamng_map = maps.beamng_levels.get_map('tig')
# maps.print_paths()
Expand Down