Configuration
The typed config hierarchy and the named scenarios.
Duckietown.AbstractSolverConfig — Type
AbstractSolverConfigCommon 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.
Duckietown.DuckControllerConfig — Type
DuckControllerConfigPedestrian 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.
Duckietown.DuckietownConfig — Type
DuckietownConfigThe 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.
Duckietown.EnvironmentConfig — Type
EnvironmentConfigSimulator/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::clockwiseor:counterclockwise(ornothing), validated like Python.spawn_route_center: world(x, z)route centre;nothingmeans 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,nothingdisables.
Duckietown.EvaluationConfig — Type
EvaluationConfigevaluation: block (tabular: episodes/seeds; SAC/TD3: development_*/final_*).
Duckietown.LaneTeacherConfig — Type
LaneTeacherConfiglane_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).
Duckietown.QLearningConfig — Type
QLearningConfigq_learning: block. allowed_actions indexes MacroAction (experiments: 0:6).
Duckietown.SacConfig — Type
SacConfigsac: block.
Duckietown.SarsaConfig — Type
SarsaConfigsarsa: block (on-policy; epsilon decayed to zero so late episodes measure the stable behaviour policy).
Duckietown.Td3Config — Type
Td3Configtd3: block. actor_update_start restarts the critic warm-up relative to the resumed update count when a checkpoint is loaded.
Duckietown.TrainingConfig — Type
TrainingConfigtraining: block. The tabular and SAC/TD3 schemas differ; optional fields carry nothing when absent in the given experiment.
Duckietown.TransitionModelConfig — Type
TransitionModelConfigtransition_model: block (present in tabular configs; disabled).
Duckietown.SCENARIOS — Constant
SCENARIOSThe 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.
| Scenario | World |
|---|---|
:lane_following | the Python defaults — no stop sign, duck effectively static |
:stop_and_duck | one stop sign and a duck that always crosses |
:stop_and_duck_safe | the 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.
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.
Duckietown.default_config — Method
default_config(algorithm::Symbol) -> DuckietownConfigConfig with every MDP parameter at its Python source default. Useful for provenance tests and for experiments that only override a handful of keys.
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.
Duckietown.load_config — Method
load_config(path) -> DuckietownConfigParse 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).
Duckietown.scenario_config — Method
scenario_config(scenario; algorithm=:q_learning) -> DuckietownConfigA 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