Skip to content

Dynamic obstacles

MiniGrid's Dynamic-Obstacles environment - reach the goal past moving balls.

See the environment class in this module for the task, layout and reward/termination details.

Bases: Environment

A room with n_obstacles Balls that each take one random step every turn; reach the goal without touching one.

Deliberately differs from real MiniGrid's DynamicObstaclesEnv in one place: real MiniGrid removes pickup/drop/toggle/done from this environment's action space entirely (Discrete(3) instead of the usual Discrete(7)), since none of them mean anything here. Navix keeps the full default action set instead, so that an agent trained across the whole navix suite sees one uniform action interface everywhere - and since Ball is Pickable (needed elsewhere, for Fetch/PutNear/GoToObject/ BlockedUnlockPickup), picking one up here ends the episode the same way walking into it already does (termination_fn composes on_ball_pickup alongside on_ball_hit), rather than either silently removing it from play or being unavailable.

To instantiate the exact MiniGrid-equivalent Discrete(3) action space instead, pass action_set explicitly:

env = navix.make(
    "Navix-Dynamic-Obstacles-5x5-v0",
    action_set=(navix.actions.rotate_ccw, navix.actions.rotate_cw, navix.actions.forward),
)

(verified directly: env.action_set/env.action_space both come out as length/Discrete(3), matching real MiniGrid, and env.step() works normally with action indices 0/1/2).