Skip to content

FL1d: a fleet's poses as a snapshot, its tick and bounds, and the gym's fleets - #1424

Merged
transfix merged 2 commits into
masterfrom
feat/fleet-poses
Nov 21, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/fleet-poses

Conversation

@transfix

Copy link
Copy Markdown
Owner

FL1d of FLEETS_AND_NIGHT_ROADMAP.md, the last part of FL1, following FL1c (#1407).

poses(fleet): what a view draws a fleet from

WorldVehicles::poses(fleet) returns a std::shared_ptr<const fleet_poses>: the fleet's placed vehicles as the last publish() left them.

  • What's in it: flat arrays of ids, chassis centres, headings, speeds and teams; the box they lie in; and the physics tick they're of.
  • How it's shared: each publish builds a new snapshot of every fleet and swaps it in whole with std::atomic_store, the way sim_thread publishes its own snapshot. A reader on any thread takes one with std::atomic_load and no lock, and keeps it as long as it likes, unchanged.
  • When it's null: for a name that isn't a fleet, and once the fleet is gone (clear()).
  • Cost: building it reuses the poses publish_groups already reads per vehicle for its counts.

The summary gains the two keys FL1a left for later:

  • .tick: the physics step the keys are of;
  • .bounds: min_x,min_y,max_x,max_y of its placed vehicles.

This is the read side that OW5's entity playout and FL2's entity layer take a fleet from.

The gym's fleets

gym_options::fleets (Python: fleets=["city"]) names the document's own fleets, its start: entries with fleet:.

  • Each reset lays them out after the options' agents, from the fleet's seed: plus the reset's seed. Each seed gets its own layout, and the same seed always gives the same one.
  • Their vehicles are agents: in the fleets' order, with goals held (a team's at its rally point). With fleets and no agents, they are the only agents.
  • A name the document doesn't declare is refused when the gym is made, listing the fleets it does declare. Python refuses a bare str for fleets=, which would otherwise read as a list of letters.
  • How the gym finds them: the gym needs the document's entries after a reset has cleared the world. So WorldVehicles::starts() keeps what spawn_starts was given since the last clear(), and the gym copies the fleets it names once, when it's made.

Docs

Tests

ariadne_scene_world_test passes locally (MSVC, Jolt).

  • AriadneWorldVehicles.AFleetsPosesAreASnapshot:
    • the snapshot matches entities() and the .tick and .bounds keys;
    • a reader thread polls poses() while the world steps 120 times, and every snapshot it sees is whole;
    • the snapshot held from before is unchanged and a newer one has come;
    • after clear() there is none.
  • AriadneWorldGym.AFleetIsTheGymsAgents:
    • the fleet's vehicles are the agents;
    • seeds 1, 2 and 1 again give two layouts, the first one twice;
    • the navigator ends the episode with all six at their held goals;
    • an undeclared fleet is refused;
    • the options' own agent comes first.
  • test_pycvc_gym.py gains fleets= and its refusals. I couldn't run pycvc on this box, so this runs first in CI's pycvc-linux.

…'s fleets

WorldVehicles::poses(fleet): the fleet's placed vehicles as the last
publish left them (fleet_poses: ids, chassis centres, headings, speeds,
teams, their box and the tick), made each publish and swapped in whole
with std::atomic_store, as sim_thread's snapshot is, so a view reads
them from any thread without a lock and keeps the one it has unchanged.
The summary gains .tick and .bounds.

The gym's fleets: gym_options::fleets (pycvc's fleets=) names the
document's fleets each reset lays out from their seed plus the reset's,
their vehicles the agents after the options' own; a name the document
does not declare is refused when the gym is made. WorldVehicles::starts
keeps the entries spawn_starts was given since the last clear(), which
the gym copies once.

Docs: ARIADNE.md's Fleets and gym sections (and the gym's tick, 7/120 s
at 120 Hz since OW1), the roadmap's FL1d row.

Tests: AFleetsPosesAreASnapshot (a reader thread while the world steps),
AriadneWorldGym.AFleetIsTheGymsAgents, test_pycvc_gym.py's fleets.
…ish a step

AFleetsPosesAreASnapshot stepped 120 ticks in one batch, which publishes once at its end, then
stopped the reader at once: on a loaded runner (ubuntu-22.04 Release) the reader had not run since
and still held tick 1. Step one tick a batch, so 120 swaps happen under the reader, and wait (5 s at
most) for it to take the newest before stopping it.
@transfix
transfix merged commit eb4e130 into master Nov 21, 2026
29 checks passed
@transfix
transfix deleted the feat/fleet-poses branch November 21, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant