Fix CPR zone ambiguity causing aircraft to appear 100km away from actual position
PROBLEM: - Aircraft were appearing ~100km from receiver when actually ~5km away - CPR (Compact Position Reporting) algorithm has zone ambiguity issue - Without reference position, aircraft can appear in wrong 6-degree zones SOLUTION: - Add receiver reference position to CPR decoder for zone resolution - Modified NewDecoder() to accept reference latitude/longitude parameters - Implement distance-based zone selection (choose solution closest to receiver) - Updated all decoder instantiations to pass receiver coordinates TECHNICAL CHANGES: - decoder.go: Add refLatitude/refLongitude fields and zone ambiguity resolution - beast.go: Pass source coordinates to NewDecoder() - beast-dump/main.go: Use default coordinates (0,0) for command-line tool - merger.go: Add position update debugging for verification - JavaScript: Add coordinate validation and update logging RESULT: - Aircraft now appear at correct distances from receiver - CPR zone selection based on proximity to known receiver location - Resolves fundamental ADS-B position accuracy issue 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
1de3e092ae
commit
f364ffe061
7 changed files with 52 additions and 31 deletions
|
|
@ -59,6 +59,7 @@ export class AircraftManager {
|
|||
|
||||
// Debug: Log coordinate format and values
|
||||
console.log(`📍 ${icao}: pos=[${pos[0]}, ${pos[1]}], types=[${typeof pos[0]}, ${typeof pos[1]}]`);
|
||||
console.log(`🔍 Marker check for ${icao}: has=${this.aircraftMarkers.has(icao)}, map_size=${this.aircraftMarkers.size}`);
|
||||
|
||||
// Check for invalid coordinates - proper geographic bounds
|
||||
const isValidLat = pos[0] >= -90 && pos[0] <= 90;
|
||||
|
|
@ -74,6 +75,8 @@ export class AircraftManager {
|
|||
const marker = this.aircraftMarkers.get(icao);
|
||||
|
||||
// Always update position - let Leaflet handle everything
|
||||
const oldPos = marker.getLatLng();
|
||||
console.log(`🔄 Updating ${icao}: [${oldPos.lat}, ${oldPos.lng}] -> [${pos[0]}, ${pos[1]}]`);
|
||||
marker.setLatLng(pos);
|
||||
|
||||
// Update rotation using Leaflet's options if available, otherwise skip rotation
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export class MapManager {
|
|||
// Store origin for reset functionality
|
||||
this.mapOrigin = origin;
|
||||
|
||||
console.log(`🗺️ Map origin: [${origin.latitude}, ${origin.longitude}]`);
|
||||
this.map = L.map('map').setView([origin.latitude, origin.longitude], 10);
|
||||
|
||||
// Dark tile layer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue