Configuration

The typed config hierarchy and the named scenarios.

Duckietown.AbstractSolverConfig — Type
AbstractSolverConfig

Common supertype of the per-algorithm solver blocks (q_learning:, sarsa:, sac:, td3:). Tabular schemas are reconstructed from the YAML because the training code is not shipped in the duckduck repository.

source
Duckietown.DuckControllerConfig — Type
DuckControllerConfig

Pedestrian crossing controller parameters (src/duck_controller.py). The defaults mirror the Python dataclass; experiments override p_cross 1.0, triggers 0.35/0.45, max_crossings_per_episode 1, and enable stop-sign injection.

spawn_pos/stop_spawn_pos are YAML-frame tile coordinates, converted to world poses by get_transform at map-preparation time.

source
Duckietown.DuckietownConfig — Type
DuckietownConfig

The complete typed view of one training_config.yaml. The solver, training, evaluation, and wandb blocks are preserved for provenance and solver adapters; the MDP is fully determined by environment, state, continuous_state, actions, duck_controller, and reward.

The solver block is stored as solver::AbstractSolverConfig (one of QLearningConfig, SarsaConfig, SacConfig, Td3Config selected by algorithm); continuous_state and lane_teacher are nothing when the experiment omits them.

source
Duckietown.EnvironmentConfig — Type
EnvironmentConfig

Simulator/environment section of the experiment YAML (environment:). Defaults mirror build_env in src/env_wrapper.py (note the source default accept_start_angle_deg = 60; the experiments set 10).

  • spawn_route_direction: :clockwise or :counterclockwise (or nothing), validated like Python.
  • spawn_route_center: world (x, z) route centre; nothing means the map centre computed at spawn time.
  • spawn_position_bounds_xz: (xmin, xmax, zmin, zmax) spawn rectangle.
  • user_tile_start, goal_tile: fixed spawn/goal tiles, nothing disables.
source
Duckietown.LaneTeacherConfig — Type
LaneTeacherConfig

lane_teacher: block (tabular configs only; the teacher is training-time infrastructure that is not shipped — Q-tables in policies/ are the final teacher-free greedy policies).

source
Duckietown.SarsaConfig — Type
SarsaConfig

sarsa: block (on-policy; epsilon decayed to zero so late episodes measure the stable behaviour policy).

source
Duckietown.Td3Config — Type
Td3Config

td3: block. actor_update_start restarts the critic warm-up relative to the resumed update count when a checkpoint is loaded.

source
Duckietown.TrainingConfig — Type
TrainingConfig

training: block. The tabular and SAC/TD3 schemas differ; optional fields carry nothing when absent in the given experiment.

source
Duckietown.SCENARIOS — Constant
SCENARIOS

The named, self-contained worlds scenario_config can build. Each is a NEW config, never a mutation of default_config: the project's rule throughout has been that a corrected or altered scenario gets its own name, so that "the defaults" keep meaning one fixed thing.

ScenarioWorld
:lane_followingthe Python defaults — no stop sign, duck effectively static
:stop_and_duckone stop sign and a duck that always crosses
:stop_and_duck_safethe same world, with the yield and stop-approach reward terms switched on

:stop_and_duck is the scenario shape the reported experiments use, but it is not byte-identical to their frozen training_config.yaml: those files also carry trained-policy hyperparameters and tuned reward weights that differ per algorithm. Use it to explore the task; use load_config on the frozen file to reproduce a reported number.

source
Duckietown._with — Method
_with(cfg; kwargs...)

Copy an immutable config struct, replacing the named fields. Used to build a scenario's reward from the defaults without mutating anything.

source
Duckietown.default_config — Method
default_config(algorithm::Symbol) -> DuckietownConfig

Config with every MDP parameter at its Python source default. Useful for provenance tests and for experiments that only override a handful of keys.

This is not the evaluated environment

The Python defaults leave inject_stop_if_missing and require_stop false, so a world built from this config contains no stop sign at all, and p_cross = 0.02 means the duck almost never crosses. The whole stop subsystem — d_stop, sigma_stop, full_stop, stop_violation — is inert, and none of the FJ8/FJ9 results can be reproduced from it.

This function is deliberately left as-is so that it keeps meaning exactly "the Python source defaults". For a world that actually exercises the task, use scenario_config; to reproduce the reported experiments, load the frozen training_config.yaml with load_config.

source
Duckietown.load_config — Method
load_config(path) -> DuckietownConfig

Parse one experiment training_config.yaml into the fully typed DuckietownConfig, applying the authoritative config hierarchy:

experiment YAML > Python source defaults, per missing key

i.e. StateConfig(**config["state"]) semantics: keys absent from the YAML fall back to the Python defaults encoded in the config structs. Values are validated exactly like the Python constructors (spawn_route_direction, spawn_min_route_alignment, spawn bounds). Unknown keys are ignored, mirroring the Python loader (only the keys each section declares are consumed).

source
Duckietown.scenario_config — Method
scenario_config(scenario; algorithm=:q_learning) -> DuckietownConfig

A self-contained config for one of SCENARIOS, needing no external file. This is what to reach for in a notebook.

:stop_and_duck turns on the two switches the Python defaults leave off — inject_stop_if_missing and require_stop — and sets p_cross = 1.0 so the duck crosses on every episode rather than 2 % of the time. Without those, the stop and duck subsystems never activate and most of the model is unreachable.

mdp = DuckietownMDP(scenario_config(:stop_and_duck); action_space=:discrete)
s   = rand(MersenneTwister(1), initialstate(mdp))
length(s.stop_signs)   # 1
source