Skip to content

Repository files navigation

WAY Mission Simulator

A deterministic vehicle mission simulator built with React, TanStack Start, Tailwind CSS, and shadcn/ui.

The simulator provides:

  • a JSON-serializable mission model matching Tina's Python mission model and serializer field names
  • the pseudonymized Italian Consegna Distretto Collinare demo mission, ordered and mapped like Tina's deserializer
  • a vertical journey of Activity cards connected by a path, with a global 10500 m entry radius (100 m by default) and uniform 1 km legs between activities
  • coordinate interpolation through mission activities over a deterministic 60-second, non-looping journey at
  • play, pause, reset, and 0.5× / / / speed controls
  • optional automatic stops at intermediate activity centers for a configurable 1300 seconds of simulation time
  • derived Pending, Entered zone, and Exited zone activity states that do not mutate WAY Activity status references
  • position events with a configurable 5060000 ms interval plus vehicle started/stopped events for playback, automatic stops, and mission completion
  • an optional server-side NATS relay for mission telemetry, single-simulator commands, command acknowledgements, and resulting state events
  • a source-first, searchable, filterable, paginated local CloudEvent journal with compact event-type pills, NATS routing subjects, and a configurable 100000-event retention limit

Run locally

Install dependencies and start the TanStack Start development server:

pnpm install
pnpm dev

The app runs on http://localhost:3010. The simulator and its event journal work without NATS. Remote commands and event publication require a NATS server reachable from the TanStack Start server process; authentication is not supported in this iteration.

NATS client protocol

See NATS Client Protocol for the complete subject map, CloudEvent schemas, command catalog, acknowledgements, event timing, delivery behavior, and runnable Python controller example.

State architecture

src/features/simulator/mission.ts mirrors Tina's Python mission data model with JSON-ready datetime and duration strings. src/features/simulator/model.ts contains the pure command-driven transition model and keeps WAY mission state, vehicle sensor state, and derived journey progress separate. Sensor coordinates interpolate through the mission coordinates, while journey distances and geofence boundaries use uniform 1 km activity legs so missing or zero km_from_start values do not disable radius simulation.

SimulatorConfiguration is versioned and JSON-serializable. It contains playback timing, the global activity radius, automatic activity-stop settings, telemetry intervals, retention limits, and NATS settings. src/features/simulator/simulator-store.ts owns the per-session TanStack Store; src/features/simulator/simulator-command-processor.ts adds run policy and transport-neutral command outcomes above the pure reducer.

React components subscribe with granular useSelector calls, so animation-frame vehicle updates rerender the journey without rerendering mission details or configuration controls. The local command processor is the shared control boundary for UI and NATS commands; the pure transition model remains transport-independent.

Commands

pnpm test     # deterministic simulator model contracts
pnpm check    # Biome formatting and lint checks
pnpm build    # production client and server bundles

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages