Summary
Implement a unified configuration system and shared libraries across all RETINA modules to eliminate duplicate configuration and code, ensuring consistency across the project.
Problem
Duplicate Configuration
Currently, each RETINA module maintains its own configuration:
tar1090-node/.env - Receiver location, adsb.lol settings
blah2-arm/config/config.yml - Full YAML config with location, frequency, etc.
adsb2dd/.env - Port and server settings
synthetic-adsb/.env - Transmitter location, frequency, radar positions
3lips/.env - Radar URLs, map center
Issues:
- Same values (lat/lon/alt, frequency, ports) duplicated across 5+ files
- Easy to get configurations out of sync
- Changing receiver location requires editing multiple files
- Hard to maintain consistency across deployments
- Error-prone manual updates
Duplicate Geometry Code
The same geometry functions are duplicated across multiple repositories:
lla2ecef() implementations found in:
adsb2dd/src/node/geometry.js (JavaScript)
blah2-arm/api/bistatic.js (JavaScript)
3lips/event/RETINAsolver/Geometry.py (Python)
retina-geolocator/lib/Geometry.py (Python)
3lips-telemetry-solver/event/algorithm/geometry/Geometry.py (Python)
RETINAsolver/Geometry.py (Python)
Additional duplicated functions:
norm() - Vector magnitude calculation
ft2m() - Feet to meters conversion
ecef2lla() - ECEF to lat/lon/alt conversion
- Bistatic delay/Doppler calculations
All implementations are mathematically equivalent (WGS84 ellipsoid model) but maintained separately.
Proposed Solutions
1. Unified Configuration System
Create a unified configuration system with three components:
Root Configuration File
Single /retina/.env file containing all shared configuration:
# Location
RECEIVER_LAT=-34.9192
RECEIVER_LON=138.6027
RECEIVER_ALT=110
TX_LAT=-34.9810
TX_LON=138.7081
TX_ALT=750
# Radio
FC_HZ=204640000
BANDWIDTH_HZ=2000000
# Ports
TAR1090_PORT=8504
ADSB2DD_PORT=49155
BLAH2_WEB_PORT=49152
Configuration Generator
Python script generate-configs.py that auto-generates service-specific configs:
- Reads from root
.env
- Generates
tar1090-node/.env
- Generates
blah2-arm/config/config.yml
- Generates
adsb2dd/.env
- Generates
synthetic-adsb/.env
- Generates
3lips/.env
Documentation
UNIFIED-CONFIG.md - Usage guide
MIGRATION-EXAMPLE.md - Migration steps from current setup
2. Shared Geometry Libraries
Create language-specific shared libraries:
JavaScript Library: @retina/geometry
retina/
└── packages/
└── geometry-js/
├── package.json
├── index.js
└── test.js
Consumers:
adsb2dd - Replace src/node/geometry.js
blah2-arm/api - Replace api/bistatic.js
tar1090-node - Use for any geometry needs
Python Library: retina_geometry
retina/
└── packages/
└── geometry-py/
├── setup.py
├── retina_geometry/
│ ├── __init__.py
│ └── geometry.py
└── tests/
Consumers:
3lips/event/RETINAsolver - Import instead of local Geometry.py
retina-geolocator - Import instead of local lib/Geometry.py
3lips-telemetry-solver - Import instead of local module
Benefits
Unified Configuration
✅ Single source of truth - All configuration in one place
✅ Consistency - No conflicting values between services
✅ Easy updates - Change receiver location once, affects all services
✅ Version control - Track all config changes in one file
✅ Deployment - Copy one file to configure entire system
Shared Libraries
✅ Single source of truth - One implementation per language
✅ Easier maintenance - Fix bugs once, affects all projects
✅ Consistent results - Identical calculations across services
✅ Unit tested - Shared test suite validates correctness
✅ Versioned - Track changes and ensure compatibility
Example Use Case
Current Workflow ❌
To change receiver location from Adelaide to Melbourne:
- Edit
tar1090-node/.env → Change LAT/LON
- Edit
blah2-arm/config/config.yml → Change location.rx.latitude/longitude
- Edit
synthetic-adsb/.env → Update RADARS JSON
- Edit
3lips/.env → Change MAP_CENTER_LAT/LON
- Restart all services individually
Total: 4-5 files edited, 5 commands
Proposed Workflow ✅
nano .env # Change RECEIVER_LAT/LON once
./generate-configs.py
docker compose restart
Total: 1 file edited, 2 commands
Implementation
Configuration System
Files to create:
Files to update:
Shared Libraries
Phase 1: Create shared packages
Phase 2: Migrate consumers
Phase 3: Documentation
Migration Path
- Create unified config system in parallel
- Create shared geometry libraries
- Test with synthetic-adsb (simplest)
- Migrate each service one-by-one
- Update deployment docs
- Remove old config files and duplicate code
Summary
Implement a unified configuration system and shared libraries across all RETINA modules to eliminate duplicate configuration and code, ensuring consistency across the project.
Problem
Duplicate Configuration
Currently, each RETINA module maintains its own configuration:
tar1090-node/.env- Receiver location, adsb.lol settingsblah2-arm/config/config.yml- Full YAML config with location, frequency, etc.adsb2dd/.env- Port and server settingssynthetic-adsb/.env- Transmitter location, frequency, radar positions3lips/.env- Radar URLs, map centerIssues:
Duplicate Geometry Code
The same geometry functions are duplicated across multiple repositories:
lla2ecef()implementations found in:adsb2dd/src/node/geometry.js(JavaScript)blah2-arm/api/bistatic.js(JavaScript)3lips/event/RETINAsolver/Geometry.py(Python)retina-geolocator/lib/Geometry.py(Python)3lips-telemetry-solver/event/algorithm/geometry/Geometry.py(Python)RETINAsolver/Geometry.py(Python)Additional duplicated functions:
norm()- Vector magnitude calculationft2m()- Feet to meters conversionecef2lla()- ECEF to lat/lon/alt conversionAll implementations are mathematically equivalent (WGS84 ellipsoid model) but maintained separately.
Proposed Solutions
1. Unified Configuration System
Create a unified configuration system with three components:
Root Configuration File
Single
/retina/.envfile containing all shared configuration:Configuration Generator
Python script
generate-configs.pythat auto-generates service-specific configs:.envtar1090-node/.envblah2-arm/config/config.ymladsb2dd/.envsynthetic-adsb/.env3lips/.envDocumentation
UNIFIED-CONFIG.md- Usage guideMIGRATION-EXAMPLE.md- Migration steps from current setup2. Shared Geometry Libraries
Create language-specific shared libraries:
JavaScript Library:
@retina/geometryretina/ └── packages/ └── geometry-js/ ├── package.json ├── index.js └── test.jsConsumers:
adsb2dd- Replacesrc/node/geometry.jsblah2-arm/api- Replaceapi/bistatic.jstar1090-node- Use for any geometry needsPython Library:
retina_geometryretina/ └── packages/ └── geometry-py/ ├── setup.py ├── retina_geometry/ │ ├── __init__.py │ └── geometry.py └── tests/Consumers:
3lips/event/RETINAsolver- Import instead of localGeometry.pyretina-geolocator- Import instead of locallib/Geometry.py3lips-telemetry-solver- Import instead of local moduleBenefits
Unified Configuration
✅ Single source of truth - All configuration in one place
✅ Consistency - No conflicting values between services
✅ Easy updates - Change receiver location once, affects all services
✅ Version control - Track all config changes in one file
✅ Deployment - Copy one file to configure entire system
Shared Libraries
✅ Single source of truth - One implementation per language
✅ Easier maintenance - Fix bugs once, affects all projects
✅ Consistent results - Identical calculations across services
✅ Unit tested - Shared test suite validates correctness
✅ Versioned - Track changes and ensure compatibility
Example Use Case
Current Workflow ❌
To change receiver location from Adelaide to Melbourne:
tar1090-node/.env→ Change LAT/LONblah2-arm/config/config.yml→ Change location.rx.latitude/longitudesynthetic-adsb/.env→ Update RADARS JSON3lips/.env→ Change MAP_CENTER_LAT/LONTotal: 4-5 files edited, 5 commands
Proposed Workflow ✅
nano .env # Change RECEIVER_LAT/LON once ./generate-configs.py docker compose restartTotal: 1 file edited, 2 commands
Implementation
Configuration System
Files to create:
/retina/.env.example- Configuration template/retina/generate-configs.py- Config generator script/retina/UNIFIED-CONFIG.md- Documentation/retina/MIGRATION-EXAMPLE.md- Migration guideFiles to update:
.gitignoreto ignore auto-generated configsShared Libraries
Phase 1: Create shared packages
Phase 2: Migrate consumers
Phase 3: Documentation
Migration Path