Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DaaS Swarm Mission Simulator

Local prototype for the DAAS agriculture architecture described in context/architecture.md and context/sim.md.

The app demonstrates:

  • Cloud Backend: Express layered backend with mission and dashboard APIs.
  • MQTT Communication: embedded Aedes broker with TCP/WebSocket endpoints, documented topics, QoS settings, and persistent client identity.
  • Mobile Base Station: React MVVM-style ViewModel with IndexedDB offline cache and batch replay.
  • Drone Swarm: simulated P2P/Event-Bus swarm modules with heartbeat, failure detection, leader election, obstacle-aware path planning, fixed-priority safety scheduling, and task redistribution.

The collision-avoidance path uses a simplified parallel-computing model: normal mission planning runs on a mission-thread lane, background telemetry/image work is treated as background-thread work, and collision replanning runs on a maximum-priority safety-thread lane. This is a deterministic simulation of the architecture tactic, not a real operating-system thread scheduler.

Prerequisites

  • Node.js 20 or newer.
  • npm, using the lockfile committed with this workspace.

Run

npm install
npm run dev

Open:

http://localhost:5173

Backend:

http://localhost:4000/api/health
http://localhost:4000/api/missions
http://localhost:4000/api/telemetry?limit=25
http://localhost:4000/api/alerts?limit=25
http://localhost:4000/api/sync-batches?limit=25
ws://localhost:4000/mqtt
mqtt://localhost:1883

Default ports can be changed with environment variables.

PowerShell:

$env:DAAS_HTTP_PORT=4000
$env:DAAS_MQTT_TCP_PORT=1883
$env:DAAS_MQTT_WS_PATH="/mqtt"

Bash:

DAAS_HTTP_PORT=4000
DAAS_MQTT_TCP_PORT=1883
DAAS_MQTT_WS_PATH=/mqtt

Verification Commands

npm run typecheck
npm test
npm run build

Demo Script

  1. Click Normal Mission or the Start button to show Cloud mission creation, MQTT command delivery, Base Station MVVM reception, swarm sectoring, and telemetry persistence.
  2. Click Obstacle Scenario, or click Place and then a field cell, to show OBSTACLE_DETECTED, COLLISION_ALERT, SCHEDULER_PREEMPTED, TRAJECTORY_CHANGE, and MOTOR_ADJUSTED. The architecture panel should show collision replanning on the safety-thread lane before normal image/spray events continue.
  3. Click Drone Failure, or one of the D1-D4 failure buttons, to show heartbeat timeout, DRONE_FAILURE, highest-battery leader election, critical alert persistence, and sector redistribution.
  4. Click Energy Offloading to lower one drone battery and show non-safety computation offloaded to the Base Station while safety-critical path replanning stays onboard.
  5. Click Network Outage to disconnect the Base Station MQTT client, keep the mission running locally, queue telemetry in IndexedDB, then replay events in batches after reconnect.
  6. Click Full Stress Demo to combine obstacle detection, outage, drone failure, sync replay, and mission completion.

The Reset button clears browser queue state and calls POST /api/demo/reset so the Cloud Backend dashboard is clean for the next run.

MQTT Topics

daas/swarm/telemetry
daas/swarm/images
daas/mission/commands
daas/alerts/critical
daas/swarm/events
daas/base/sync-status

Project Structure

apps/client   React + Phaser Mobile Base Station and simulator
apps/server   Express Cloud Backend + Aedes MQTT broker + SQLite persistence
packages/shared   Shared event, mission, drone, and topic contracts

The backend stores data in apps/server/data/daas.sqlite. Delete that directory before a presentation if you want a clean dashboard history.

MQTT durability note: the prototype uses a stable Base Station client id and clean: false, while IndexedDB remains the authoritative offline queue for field outages. The embedded Aedes broker is intentionally local and process-lifetime only; production broker persistence is out of scope for this demo.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages