Skip to content

JasSra/LiveFlight

Repository files navigation

LiveFlight

LiveFlight is a stateless ASP.NET Core MVC application that visualises a Microsoft Flight Simulator aircraft on a Google Maps vector map while surfacing contextual points of interest on the aircraft's left and right sides. Live telemetry is relayed to connected browsers via SignalR and every five seconds the server proxies the Google Places API to surface the closest matching location within expanding search radii.

Projects

  • FlightServer/ – ASP.NET Core 9 MVC + SignalR application hosting the REST endpoints, SignalR hub, and Razor client.
  • SimConnectWorker/ – Windows-only helper that reads Microsoft Flight Simulator (2020/2024) telemetry via SimConnect and posts it to the server. See the worker README for build and deployment notes.

MVP Roadmap

Step Focus Status Notes
1 Stand up stateless ASP.NET Core MVC host with SignalR hub and /api/telemetry ingest ✅ Done Server receives telemetry payloads and re-broadcasts them to /hubs/telemetry.
2 Implement Google Places proxy with sector filtering and progressive radii ✅ Done /api/places/query calls Places Nearby Search with field masks, computes bearings/distances, and returns the first in-sector match.
3 Build Razor client with Google Maps vector view, rotating aircraft marker, and side panels ✅ Done Views/Home/Index.cshtml keeps the camera aligned with telemetry, throttles Places calls to 5 s, and renders photo thumbnails when available.
4 Document Docker workflow and environment expectations ✅ Done README instructions cover publishing, container build/run, and environment variables.
5 Produce Windows SimConnect worker that streams 2 Hz telemetry to the server ✅ Done Comprehensive worker implemented with dual-mode operation (simulated/real), 25+ telemetry parameters, cross-platform development support, and production-ready template for native MSFS integration.
6 End-to-end validation with live MSFS session and Google Places quotas ⬜ Next Worker is complete; validation requires Google API credentials configuration and MSFS environment for real SimConnect testing.
7 AI Enhancement & Voice Interaction ✅ Done AI smart agent with OpenAI/Ollama support, voice commands, and contextual insights panel. See AI Integration Guide.

Key Features ✨

Real-time Flight Tracking

  • Smooth Motion: 60 FPS aircraft animation with great-circle interpolation
  • Auto-zoom: Speed-adaptive map zoom for optimal viewing
  • Tracking Modes: Follow mode (auto-center) or Free mode (manual pan)
  • Units: Switch between Metric and Aviation units

AI-Enhanced Awareness 🤖

  • Smart Insights: AI-generated contextual observations about flight phase, altitude changes, and safety
  • State Tracking: Historical telemetry analysis with previous state comparison
  • Voice Interaction: Speech-to-Text commands and Text-to-Speech feedback
  • Multiple Providers: Support for OpenAI, Ollama (local), or Disabled

Telemetry & Visualization

  • Comprehensive Data: 25+ telemetry parameters (position, speed, altitude, engine, fuel, etc.)
  • Live Graphs: Real-time charts for altitude, speed, vertical speed, and heading
  • Breadcrumb Trail: Visual path history with altitude-based coloring
  • Compass Rose: Heading indicator with cardinal directions

Aviation Data Layers

  • Airports: Nearby airports with runways, frequencies, and details
  • Points of Interest: Contextual landmarks and cities
  • Weather: METAR/TAF integration (coming soon)

Step 5 Implementation Summary

The SimConnect worker has been successfully implemented with the following key features:

✅ Dual-Mode Operation

  • Simulated Mode: Cross-platform telemetry generation for development/testing
  • Real Mode: Windows-native SimConnect integration for live MSFS data

✅ Comprehensive Telemetry

  • 25+ data points including position, attitude, speed, engine, environmental, and GPS data
  • 2Hz streaming frequency (500ms intervals) for real-time responsiveness
  • JSON format compatible with existing server telemetry structure

✅ Production Ready

  • Resilient error handling with network failure recovery
  • Visual status monitoring with connection health indicators
  • Automatic fallback from real to simulated mode when MSFS unavailable
  • Windows-optimized build configuration with cross-platform development support

Next Phase Requirements (Step 6)

With the SimConnect worker now complete, the next phase focuses on end-to-end validation and production deployment readiness:

Environment Setup

  • Google Maps API Key: Configure GOOGLE_MAPS_API_KEY environment variable for Places API integration
  • Maps JavaScript Key / Map ID: Provide GOOGLE_MAPS_JS_API_KEY and GOOGLE_MAPS_MAP_ID via config (the view reads these from configuration)
  • MSFS Environment: Set up Microsoft Flight Simulator 2020/2024 with SimConnect SDK for real telemetry testing

Validation Checklist

  • API Integration: Test Google Places API with valid credentials and quotas
  • Real MSFS Connection: Validate native SimConnect integration with live flight data
  • SignalR Connectivity: Ensure real-time telemetry streaming works in production environments
  • Performance Testing: Verify 2Hz telemetry streaming under load
  • Error Handling: Test network resilience and failover scenarios

Requirements

  • .NET SDK 9.0 (for local development).
  • Google Maps Platform API key with Places API and Maps JavaScript API enabled. Restrict it to your deployment hostnames.
  • Access to Microsoft Flight Simulator (2020 or 2024) if you plan to run the SimConnect worker.

Configuration

The server reads configuration from environment variables:

Variable Purpose
GOOGLE_MAPS_API_KEY Google Cloud API key used for Places API requests and constructing Place Photo URLs.
GOOGLE_MAPS_JS_API_KEY Google Maps JavaScript API key for the client map loader. Falls back to GOOGLE_MAPS_API_KEY if not provided.
GOOGLE_MAPS_MAP_ID Vector map ID used by the Google Maps JS API. Required for Advanced Markers.
\n### AI Configuration

Configure AI-enhanced awareness features:

Setting Default Purpose
AI:Provider Disabled AI provider: OpenAI, Ollama, or Disabled.
AI:OpenAIApiKey "" OpenAI API key (required for OpenAI provider).
AI:OpenAIModel gpt-3.5-turbo OpenAI model to use.
AI:OllamaEndpoint http://localhost:11434 Ollama endpoint URL (for Ollama provider).
AI:OllamaModel llama2 Ollama model to use.
AI:EnableStateTracking true Track historical telemetry states.
AI:MaxHistoricalStates 100 Maximum number of historical states to keep.
AI:InsightIntervalSeconds 30 Minimum seconds between AI-generated insights.
AI:EnableVoiceInteraction true Enable browser voice commands (STT/TTS).

See the AI Integration Guide for detailed setup instructions.

Optional throttling and safety settings for Google Places:

Setting Default Purpose
Places:MinDistanceNm 20 Minimum nautical miles from the last successful query center before issuing a new Places request. Set to 10–20 to match your preference.
Places:DebounceSeconds 10 Minimum seconds between Places requests (server-side debounce).
Places:MaxRadiiPerRequest 3 Maximum number of radii considered per query to avoid multi-call storms.

Optional speed-aware thresholds (disabled by default):

Setting Default Purpose
Places:UseSpeedAdaptiveThresholds false Interpolate debounce and distance thresholds based on ground speed when true.
Places:MinDistanceNmAt0Kt 12 Minimum distance at 0 kt.
Places:MinDistanceNmAt200Kt 25 Minimum distance at 200 kt.
Places:DebounceSecondsAt0Kt 6 Debounce seconds at 0 kt.
Places:DebounceSecondsAt200Kt 12 Debounce seconds at 200 kt.

You can override these via environment variables using double-underscore notation, for example:

# PowerShell
$env:Places__MinDistanceNm = "20"
$env:Places__DebounceSeconds = "10"
$env:Places__UseSpeedAdaptiveThresholds = "true"
$env:Places__MinDistanceNmAt0Kt = "12"
$env:Places__MinDistanceNmAt200Kt = "25"
$env:Places__DebounceSecondsAt0Kt = "6"
$env:Places__DebounceSecondsAt200Kt = "12"

Client map configuration comes from server settings so you don't need to hardcode keys in views:

  • GOOGLE_MAPS_JS_API_KEY – the key used in the Maps JS loader script.
  • GOOGLE_MAPS_MAP_ID – your vector map ID.

Running locally

cd FlightServer
export GOOGLE_MAPS_API_KEY=YOUR_KEY
DOTNET_URLS=http://localhost:8080 dotnet run

Open http://localhost:8080/ to view the map. Use a tool such as curl or the SimConnect worker to post telemetry to /api/telemetry.

Docker

The repository contains a Dockerfile tailored for publishing the server:

cd FlightServer
# publish the app (generates ./publish)
dotnet publish -c Release -o publish
# build the container image
docker build -t liveflight:latest .
# run the container
docker run -it --rm -p 8080:8080 -e GOOGLE_MAPS_API_KEY=YOUR_KEY liveflight:latest

HTTP endpoints

POST /api/telemetry

Broadcasts aircraft telemetry to all SignalR subscribers.

Body:

{
  "lat": -27.384,
  "lon": 153.117,
  "hdgTrue": 92.3,
  "tsUtc": "2025-09-27T02:31:14Z"
}

POST /api/places/query

Proxies Google Places Nearby Search and applies left/right sector filtering.

Body:

{
  "lat": -27.384,
  "lon": 153.117,
  "heading": 92.3,
  "side": "left",
  "radiiKm": [5, 10, 20, 50],
  "maxResults": 1
}

Response contains the closest qualifying place (if any) along with a signed Place Photo URL.

Server-side guardrails ensure that:

  • Inputs are validated (lat/lon ranges, positive radii) to prevent malformed Google requests.
  • Requests are debounced (Places:DebounceSeconds) and suppressed unless the aircraft has moved at least Places:MinDistanceNm from the last query.
  • Radii are normalized (clamped to 50 km, de-duplicated) and limited to Places:MaxRadiiPerRequest.

SimConnect worker

See SimConnectWorker/README.md for details on building and running the Windows worker that pushes Microsoft Flight Simulator telemetry to the server.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •