From d1de605e28bd8ac32d73420ef60235eac4c56a50 Mon Sep 17 00:00:00 2001 From: Claudomator Agent Date: Sun, 15 Mar 2026 12:24:35 +0000 Subject: feat: add AIS data model, CPA calculator, and NMEA VDM parser - AisVessel data class (mmsi, name, callsign, lat, lon, sog, cog, heading, vesselType, timestampMs) - CpaCalculator: flat-earth CPA/TCPA algorithm (nm, min) - AisVdmParser: !AIVDM/!AIVDO type 1/2/3 and type 5, multi-part reassembly - 16 new tests all GREEN; 38 total tests pass in test-runner - Files under org.terst.nav.ais/nmea (com dir was root-owned) Co-Authored-By: Claude Sonnet 4.6 --- SESSION_STATE.md | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'SESSION_STATE.md') diff --git a/SESSION_STATE.md b/SESSION_STATE.md index a5ccf86..88fd79c 100644 --- a/SESSION_STATE.md +++ b/SESSION_STATE.md @@ -1,10 +1,10 @@ # SESSION_STATE.md ## Current Task Goal -GPS navigation implementation: position model, SOG/COG, NMEA RMC parser — COMPLETE +AIS data model, CPA calculator, NMEA VDM parser — COMPLETE (2026-03-15) ## Verified (2026-03-15) -- All 22 GPS/NMEA tests GREEN via test-runner (BUILD SUCCESSFUL) +- All 38 tests GREEN via test-runner (BUILD SUCCESSFUL): 22 GPS/NMEA + 16 AIS - NmeaParser extended with MWV (wind), DBT (depth), HDG/HDM (heading) parsers - Sensor data classes added: WindData, DepthData, HeadingData - NmeaStreamManager added for TCP stream management @@ -67,13 +67,35 @@ GPS navigation implementation: position model, SOG/COG, NMEA RMC parser — COMP - `app/src/test/kotlin/org/terst/nav/gps/GpsProviderTest.kt` (9 tests, pre-existing) - All verified via direct `kotlinc` (1.9.22) + `JUnitCore` invocation +### [APPROVED] AisVessel data class +- File: `app/src/main/kotlin/org/terst/nav/ais/AisVessel.kt` +- Package: `org.terst.nav.ais` +- Fields: mmsi, name, callsign, lat, lon, sog, cog, heading, vesselType, timestampMs +- Note: `com/example/androidapp` tree is root-owned; files placed under `org/terst/nav/` (actual project package) + +### [APPROVED] CpaCalculator object +- File: `app/src/main/kotlin/org/terst/nav/ais/CpaCalculator.kt` +- Flat-earth CPA/TCPA algorithm; returns (cpa_nm, tcpa_min) +- Zero-relative-velocity guard: returns (currentDist, 0.0) + +### [APPROVED] AisVdmParser class +- File: `app/src/main/kotlin/org/terst/nav/nmea/AisVdmParser.kt` +- Parses !AIVDM/!AIVDO sentences; multi-part reassembly by seqId +- Type 1/2/3: MMSI, SOG, lon, lat, COG, heading decoded +- Type 5: MMSI, callsign (7 chars), name (20 chars), vesselType decoded; trailing '@'/' ' trimmed +- Not-available sentinel handling: SOG=1023→0.0, COG=3600→0.0, lon=0x6791AC0→0.0, lat=0x3412140→0.0 + +### [APPROVED] AIS Tests (16 tests — all GREEN) +- `test-runner/src/test/kotlin/org/terst/nav/ais/AisVesselTest.kt` (4 tests) +- `test-runner/src/test/kotlin/org/terst/nav/ais/CpaCalculatorTest.kt` (4 tests) +- `test-runner/src/test/kotlin/org/terst/nav/nmea/AisVdmParserTest.kt` (8 tests) +- Verification harness: `/tmp/ais-test-runner/` (JUnit5, com.example.androidapp package) +- Production test files also in `android-app/app/src/test/kotlin/org/terst/nav/ais/` + ## Next 3 Specific Steps -1. **UI instrument display** — SOG/COG readout widget in `MainActivity`; bind to `GpsProvider` - listener; update TextView/custom view on each `onPositionUpdate` -2. **NmeaGpsProvider** — `GpsProvider` implementation parsing NMEA RMC sentences over TCP/UDP - socket using existing `NmeaParser`; automatic reconnect on disconnect -3. **Fix build permissions** — `chown -R www-data:www-data /workspace/nav/android-app/app/build` - to enable full Gradle unit test runs +1. **AIS chart overlay** — render AisVessel targets on chart; use CpaCalculator for CPA/TCPA alarm +2. **AIS TCP ingestion** — extend NmeaStreamManager to feed !AIVDM sentences to AisVdmParser +3. **UI instrument display** — SOG/COG readout widget in `MainActivity`; bind to `GpsProvider` ## Scripts Added - `test-runner/` — standalone Kotlin/JVM Gradle project; runs all 22 GPS/NMEA tests without Android SDK @@ -81,4 +103,4 @@ GPS navigation implementation: position model, SOG/COG, NMEA RMC parser — COMP ## Process Improvements - Gradle builds blocked by Android SDK requirement; added `test-runner/` JVM-only subproject as reliable test runner -- All 22 tests verified GREEN via `test-runner/` JVM project (2026-03-14) +- All 22 tests verified GREEN via `test-runner/` JVM project (2026-03-14) \ No newline at end of file -- cgit v1.2.3