Ground Control Station for Flightpath
The architecture uses RxJS observables as a reactive layer between the MAVLink protocol and React components. This approach provides several key benefits:
-
Declarative Logic & Cleaner Code: Instead of imperative
useEffectchains, RxJS defines data transformations declaratively. This centralizes business logic outside of components, making the code more readable and easier to maintain. SeeFlightStatusServiceas an example. -
Efficient State Propagation: Updates are only propagated to the specific components that subscribe to a stream. This avoids the "unnecessary re-render" issue common with React Context, where updating one value can re-render an entire component tree.
-
Decoupled Architecture: Business logic is kept in pure TypeScript classes as observables, entirely independent of React. This makes the logic more portable and significantly easier to unit test without the overhead of rendering components.
- Install Node Version Manager (nvm). It allows using different versions of node via the command line
- Run
nvm useto use the required version of node. - Run
pnpm ito install required packages. - Start a PX4 SITL by following the instructions in PX4 SITL Setup.
- Run the Flightpath Server by following the instructions in the
Flightpath repository
(
go run cmd/server/main.go).
pnpm devNow point your browser to http://localhost:3000
cd apps/flightpath-ui-radix
pnpm build
pnpm previewNow point your browser to http://localhost:3000
pnpm build # builds prod bundles
pnpm clean # deletes all build artifacts
pnpm dev # run all dev builds
pnpm fix # lints, formats and attempts to fix any issues (requires `pnpm build` has been ran)
pnpm lint # runs the linter, useful for debugging lint issues (generally `pnpm fix` is preferred)
pnpm preview # runs the prod build (go to the appropriate app directory first)
| CPU | gRPC Stream | FPS |
|---|---|---|
| No throttling | ❌ | 60 |
| 4x slowdown | ❌ | 60 |
| 6x slowdown | ❌ | 60 |
| 20x slowdown | ❌ | 55 |
| No throttling | ✅ | 60 |
| 4x slowdown | ✅ | 42 |
| 6x slowdown | ✅ | 24 |
| 20x slowdown | ✅ | 10 |

