Real Time Collision Detection Using AIS-catcher #338
tkreyche
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
As an ocean racer and member of US Sailing's Safety at Sea committee, I have to offer the obligatory caution about relying on arguably experimental safety gear. With that out of the way, this sounds like a fine implementation, but would add a watchdog of some sort that will let you know if it stops working. Such a thing was lacking on my professional installation and I almost got run down mid-ocean. Missed by 500 feet! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Cautions
The use of AIS-catcher, OpenCPN and any other software for marine collision detection should be considered strictly experimental. Software and/or hardware problems could result in serious consequences. Use at your own risk! It is every mariner's responsibility to keep a sharp lookout, obey traffic rules and monitor appropriate radio channels.
I have not run collision detection software on the water, but I suspect that in heavy traffic areas it will be difficult to configure an application to prevent false alarms. An unfortunate scenario would be for someone to get used to false alarms and then ignore a real threat. Note that the apps described here don't take land masses into account. OpenCPN will cheerfully generate an alert from a vessel headed in your direction but on the other side of an island.
Introduction
This discussion is about using AIS-catcher to receive AIS messages directly from a on-board receiver and local app to detect potential collisions with other vessels - this is a receive-only system. An AIS transponder (with transmit capabilities) is required for a vessel to broadcast its location to other vessels.
Local vs Remote Data
This equipment setup with AIS-catcher receiving AIS transmissions directly from other vessels. It is very different from simply using an app on your phone which gets data from an online source. Latency from online data will degrade collision detection, with the latency unknown and unpredictable. The use depends on whether you are looking to improve general situational awareness or are seriously attempting to implement near real-time collision detection. I don't know if there are any phone-based collision detection apps that will take data from a local source. It would be possible using SignalK to send data wirelessly to a phone.
Collision Danger from Fast Ferries and other Vessel Traffic
In Puget Sound, passenger-only ferries typically operate at over 30kt and car ferries over15kt. A vessel travelling at 35kt covers 60 feet/sec (18 m/sec) and detection latency depends on how often it is transmitting. For Class A vessels, this should be every 2 seconds but if for some reason one reception is missed, in 4 seconds the vessel will travel almost 250 ft (75 m).
There are also numerous other vessels, including cruise ships, tugs towing barges, container ships, commercial fishing and occasional navy ships. These ships operate in designated traffic lanes with the expectation that other vessels will observe right of way rules. Many of these ships are very large and have limited ability to slow or change course to avoid collisions. Many small recreational boats don't have AIS transponders and can only be spotted visually.
AIS-catcher Setup
You will need to have AIS-catcher running on a computer on your boat, for example on a Raspberry Pi with an RTL-SDR dongle with a basic antenna. A simple vertical dipole made out of coax would probably work fine...we're just looking for local line-of-sight detection.
OpenCPN Solution
You will also need a computer running OpenCPN. This is not an endorsement for that software, however it is widely used. Personally, I don't like the UI - it seems a bit antiquated. In any case, OpenCPN could be run on a separate computer such as a laptop. A Raspberry Pi 5 with an NVMe drive could probably handle running both AIS-catcher and OpenCPN.
Connection Configuration
Configure AIS-catcher to send data to OpenCPN via UDP with the -u option.
Configure OpenCPN to receive the data from AIS-catcher. Options for configuring OpenAIS are under Ships->Targets. See screenshots from OpenCPN version 5.10.2 (click to enlarge):
AIS Configuration
Simulated Detection using OpenCPN
Here are some example screen shots of collision scenarios using OpenCPN. It depicts a vessel performing collision detection, with AIS-catcher provide real-time data. The simulated vessel's location is provided from a Python script, which generates an NMEA0183 RMC sentence.
In this example, the simulated vessel is headed south in the west lane of the Puget Sound Traffic Separation Scheme. The vessel is approaching a heavily used ferry route between Seattle and Bainbridge Island, which crosses the N-S traffic lanes . One ferry is departing the terminal on Bainbridge, the other is departing the terminal in Seattle in the opposite direction.
Here the simulated vessel is in imminent danger of a collision with the ferry Chimacum, and at some risk from the ferry Walla Walla, which is several miles away. There is a yellow highlight on the project path for the vessel Doc Maynard but there doesn't seem to be an immediate problem.
The vessel departing Seattle is several miles away and doesn't appear to be a threat.
Here are multiple historical tracks for the fast ferry Lady Swift, which operates at 30+ kts. It has a predictable route but occasionally makes deviations.
Lady Swift
SignalK Solution
Another option is to use SignalK with a plugin. This is not a complete solution, it's just a service that sends notifications, which will then need to be consumed by an app. This particular plug-in appears to be the work of an individual, compared to OpenCPN which is a team effort.
The AIS-catcher configuration is exactly the same as for OpenCPN.
The SignalK configuration is similar to OpenCPN. In SignalK, create a new data connection with Data Type of NMEA0183, source UDP and use the port number that you configured in AIS-catcher. This will be the same for receiving AIS-catcher data in SignalK for any purpose.
You should be able to look in the data browser and see entries like this:
You can subscribe to a SignalK Server data stream using a websocket, for example at ws://localhost:3000/signalk/v1/stream?subscribe=all" which shows the AIS-catcher NMEA0183 translated into json like this:
{"context":"vessels.urn:mrn:imo:mmsi:367460660","updates":[{"source":{"sentence":"VDM","talker":"AI","type":"NMEA0183","label":"aiscatcher"},"timestamp":"2024-12-06T21:05:04.965Z","values":[{"path":"","value":{"mmsi":"367460660"}},{"path":"navigation.speedOverGround","value":0},{"path":"navigation.courseOverGroundTrue","value":4.040437219289424},{"path":"navigation.headingTrue","value":5.358160804846018},{"path":"navigation.state","value":"fishing"},{"path":"sensors.ais.class","value":"A"},{"path":"navigation.specialManeuver","value":"not available"},{"path":"navigation.position","value":{"longitude":-122.32988833333333,"latitude":47.633965}}],"$source":"aiscatcher.AI"}]}
AIS-catcher positions will show up on the SignalK webapp called "Vesselpositions" like this, but again this is just a visual display - no collision detection:
There are only a couple of configuration items in the plug-in itself: Collision Detection Distance and Data Timeouts....minimal compared to the options in OpenCPN.
The collision-detector offers a notifications.danger.collision subscription, which would allow someone to consume the data and write their own app, which could probably run on the same system as AIS-catcher and the SignalK server.
Using the same simulator as the one used for OpenCPN, the plug-in generates the following json:
{"context":"vessels.urn:mrn:signalk:uuid:5b251727-b8c6-4b6d-8c0e-c85952c9c3fc","updates":[{"values":[{"path":"notifications.danger.collision","value":{"method":["visual","sound"],"state":"alarm","message":"Collision danger!","source":"collision-detector","vessels":{"urn:mrn:imo:mmsi:367712660":{"lon":-122.47206833333334,"lat":47.607585,"bearing":243.1276863457611,"dist":594.0473347014798}}}}],"source":{"label":"collision-detector"},"timestamp":"2024-12-06T23:10:28.036Z","$source":"collision-detector.XX"}]}
The plug-in documentation does not state the units for distance, presumably it's in meters. I wish apps would round useless decimal places.
Here's what shows on a map at the time of the notification (the circle is hand-drawn):
Beta Was this translation helpful? Give feedback.
All reactions