Adapters¶
Framework adapters that wrap OrbitalGymEnv for Gymnasium, PettingZoo, and POMDPPlanners-shape consumers.
Gymnasium¶
orbitalgym.adapters.gymnasium.adapter.GymnasiumAdapter ¶
Bases: Env
A gymnasium.Env wrapping a SingleAgentView.
PettingZoo¶
orbitalgym.adapters.pettingzoo.adapter.PettingZooAdapter ¶
Bases: ParallelEnv
Multi-agent adapter using pettingzoo's Parallel API.
Each vehicle is a separate agent. Agent IDs are <side>_<index>
(e.g. 'guard_0', 'bandit_0'). All agents step simultaneously.
POMDPPlanners-shape¶
(duck-typed protocol, not an external import)
orbitalgym.adapters.pomdp.adapter.POMDPAdapter ¶
Flat-state-vector adapter conforming to POMDPPlanners-shape.
Pure: every public method is a function of its arguments alone. Safe
to drive under jax.vmap / jax.lax.scan / jax.jit.
action_dim_per_side
property
¶
Per-agent flat action width.
Both sides must agree on the per-agent dim for this property to be
meaningful (planners that call this typically assume a single
per-agent action width). When sides have different Command shapes,
callers should use guard_action_flat_dim / bandit_action_flat_dim
directly.
bandit_action_flat_dim
property
¶
Total flat width of the bandit side's Command pytree.
guard_action_flat_dim
property
¶
Total flat width of the guard side's Command pytree.
states_dim
property
¶
Flat-state width: layout.flat_dim, the (t, step) tail, and the dwell counters.
initialstate ¶
Sample an initial state and return its flat vector.
observation ¶
Return the side's observation at the next state.
reward ¶
Return the side's reward for the macro step.
With action_repeat = 1 this is the single-step reward over the
supplied (s, a, s') triple. With action_repeat = k it is the
sum of the k per-substep rewards discounted by step_discount per
substep, zero after a terminal substep; the intermediate states are
not available from this signature, so the substeps are re-simulated
from s_flat and s_next_flat is ignored. Re-simulation is
exact: translational and attitude dynamics are deterministic given
the state and action, and observation noise keys never enter the
reward. Prefer :meth:step, which returns the next state and the
reward from one rollout.
step ¶
Advance one macro step and return (s_next_flat, reward).
The planner-facing entry point: one rollout serves both the next state and the side's discounted macro-step reward, so a search does not simulate the substeps twice.
transition ¶
Apply action_repeat env steps of a_flat.
a_flat is the concatenated guard+bandit action. Every substep
goes through the env, so each one applies the env's own per-step
delta-v cap: a macro action is k capped burns in one direction,
exactly what the env executes when a policy repeats the command.
Substep keys are splits of key. Once a substep reports
episode_done the state is frozen for the remaining substeps.