fix: exp14 — proper track switch via exit_scene before connecting to mountain_track

This commit is contained in:
Paul Huliganga 2026-04-19 19:18:33 -04:00
parent 1405a88699
commit b1ec14e3cb
1 changed files with 14 additions and 0 deletions

View File

@ -132,6 +132,20 @@ log(f' Stop: eval every {EVAL_EVERY:,} steps, stop at {LAP_STOP} laps')
log(f' Safety ceiling: {MAX_STEPS:,} steps') log(f' Safety ceiling: {MAX_STEPS:,} steps')
log('='*60) log('='*60)
# ---- Switch sim to mountain_track ----
# Must exit current scene via existing connection, then reconnect fresh.
log('Switching sim to mountain_track...')
_tmp = gym.make('donkey-generated-track-v0', conf={'host': HOST, 'port': PORT})
time.sleep(2)
try:
_tmp.unwrapped.viewer.exit_scene()
time.sleep(0.5)
except Exception as e:
log(f' exit_scene warning: {e}')
_tmp.close()
time.sleep(6) # wait for sim to return to main menu
log('Sim should now be at main menu. Connecting to mountain_track...')
env = VecTransposeImage(DummyVecEnv([make_env()])) env = VecTransposeImage(DummyVecEnv([make_env()]))
model = PPO('CnnPolicy', env, learning_rate=LR, verbose=1, device='cpu') model = PPO('CnnPolicy', env, learning_rate=LR, verbose=1, device='cpu')
log('PPO created. Training...') log('PPO created. Training...')