town_run — DRIVE town op

• Data kinds: table → table

• Call: import fullseye as fs; fs.ledger.town_run(layout, *, dt: 'float' = 0.05, v_max: 'float' = 8.0, a_max: 'float' = 1.5, b_max: 'float' = 3.0, stop_at: 'Optional[Sequence[str]]' = None, stop_hold: 'Optional[float]' = None, look_hold: 'Optional[float]' = None, stop_margin: 'float' = 0.5, idm_T: 'float' = 1.0, v_stop: 'Optional[float]' = None, t_max: 'Optional[float]' = None, rules: 'Optional[dict]' = None, train=None) -> 'Dict[str, object]' (to call the implementation directly, import drivetown; drivetown.town_run(layout, *, dt: 'float' = 0.05, v_max: 'float' = 8.0, a_max: 'float' = 1.5, b_max: 'float' = 3.0, stop_at: 'Optional[Sequence[str]]' = None, stop_hold: 'Optional[float]' = None, look_hold: 'Optional[float]' = None, stop_margin: 'float' = 0.5, idm_T: 'float' = 1.0, v_stop: 'Optional[float]' = None, t_max: 'Optional[float]' = None, rules: 'Optional[dict]' = None, train=None) -> 'Dict[str, object]'; from the registry, opsdrive.get("town_run"))

Usage

A longitudinal-only end-to-end run along the centerline (rule-based).

At each step, the next target stop line not yet stopped at is treated as "a stopped leading vehicle", drivetraffic.idm_accel(v, gap = 停止線 − 前端, dv = v, v0 = v_max, T = idm_T, a = a_max, b = b_max, s0 = stop_margin) gives the acceleration, clipped to [−b_max, a_max] (if there is no target, gap = ∞ = free driving). v is updated first (0 ≤ v ≤ v_max), s by the trapezoidal rule. If v ≤ v_stop and the front end is within 1.0 m of the stop line, the car is stopped.

How targets are determined (rules = town_rules, None = JP): intersections are always targets (signals follow the rule of green after stop_hold seconds). Railway crossings are targets always if rules["crossing_stop"] is "always", and only while the warning of train is active (entry_forbidden) if it is "when_active". If with "when_active" the car cannot stop with b_max when the warning begins (gap < v²/(2 b_max)), it proceeds (event "commit"). Passing stop_at overrides the rules (sequence of kinds. For regression). After stopping: at intersections, hold for stop_hold (default rules["hold_s"]) seconds (mode "hold"); at railway crossings, if rules["look_required"], look left, right, left, right for look_hold (default rules["look_hold_s"]) seconds each (mode "look"). If train is given, even after the hold ends the car waits while the warning is active (boom lowering through raising) (mode "wait"). train = t_warning or (t_warning[, v_train[, length]]) or a dict (times are standard values from the interpretation basis, TRAIN_DEFAULTS).

Returns

dict : t, s, x, y, z, v, yaw, a (each (n,)), mode (n,) strings ("cruise" / "brake" / "hold" / "look" / "wait"),

stops = [(s_stop, kind, t_arrive, t_leave), ...], events = [("stop"|"go"|"look"|"wait_gate"|"commit"|"pass"|"end", t, ...)], stop_lines (stop lines that could become targets), targets ("static" / "dynamic" per stop line), train (dict of times or None), rules, params, total_length.

Raises ValueError: layout is neither from town_chain nor the "route" of drivejapan.osm_route, dt/v_max/a_max/b_max/hold times invalid, unknown kind in stop_at, rules/train invalid, the stop line was overrun (outside IDM's assumptions), the end is not reached by t_max.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• poc_driving_japan_town — py -3.11 examples/poc_driving_japan_town.py

• poc_driving_town — py -3.11 examples/poc_driving_town.py

Ops the type connects to (they accept table as input)

course_layout · course_occupancy · course_contains · world_build · world_camera · world_move · lidar_scan · rss_longitudinal_same

Same category (town)

town_chain · town_layout · town_world · town_centerline · town_stop_lines · town_rules · town_crossing_state · town_checks


*Provenance: drivetown.py — DRIVE operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.