From b1ec14e3cb9ba7c26e8087ceed13ec51fba8ff82 Mon Sep 17 00:00:00 2001 From: Paul Huliganga Date: Sun, 19 Apr 2026 19:18:33 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20exp14=20=E2=80=94=20proper=20track=20swi?= =?UTF-8?q?tch=20via=20exit=5Fscene=20before=20connecting=20to=20mountain?= =?UTF-8?q?=5Ftrack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/experiments/exp14_mountain_v5.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/agent/experiments/exp14_mountain_v5.py b/agent/experiments/exp14_mountain_v5.py index 8f54a26..1a43e04 100644 --- a/agent/experiments/exp14_mountain_v5.py +++ b/agent/experiments/exp14_mountain_v5.py @@ -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('='*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()])) model = PPO('CnnPolicy', env, learning_rate=LR, verbose=1, device='cpu') log('PPO created. Training...')