gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] AIS Type 24 handling


From: Roy Barkas
Subject: [gpsd-dev] AIS Type 24 handling
Date: Wed, 10 Jul 2013 23:33:57 +1000

Some time ago, I posted a suggestion about handling of orphaned type 24 'a' or 'b' message processing in gpsd.  Eric replied that there is a holding buffer for unmatched type 24 packets and he could increase the buffer size if needed.  Unfortunately that won't work for us.

We've got a couple of gpsd instances running that each process just over 2 million AIS messages per day that are sourced from satellite and terrestrial networks.

gpsd handles this huge workload gracefully and reliably, with one exception.

type 24 messages almost never appear as output, even though thousand are presented.  I believe that this is due to gpsd expecting that every type 24A message will be followed in reasonably short order by a matching type 24B.  As I recall, there is a buffer somewhere that holds unmatched type 24A messages up to some defined number, then when 24B messages arrive it finds the matching 24A and combines the two into a complete type 24 message on the output.

This is fine when type 24 A and B messages arrive more or less as pairs.  But the feed from the satellites don't produce that.  I may see thousands of type 24A's before a 24B comes along, or (less often) the opposite.  I suspect that this is because the satellite receivers are rate limited for messages that arrive  with a fragment count and fragment number of 1 and 1.  It appears that all type 24 messages arrive with a count and a fragment number of 1, whether they are type A or B. 

Other multi-part messages (like Type 5) use the fragment count and number as intended (2,1 and 2,2) so they don't get dropped by the rate limiter.

Other than backward compatibility, I don't think there is any reason that type 24 A and B messages couldn't be handled as if they were different completely different, separate message types.  Type A contains an mmsi and vessel name, type 4B contains an mmsi and other static info.  There is no data overlap other than mmsi.

I realize that most applications don't experience this issue and that the current mode of operation needs to remain unchanged lest it break them.

My suggestion is that an option be added to the gpsd command line that explicitly requests independent type 24 handling.  When this option is invoked gpsd could output type 24A's with their mmsi and shipname when it received them and output mmsi and other static data when it received a 24B.  Or gpsd could output a complete type 24 message with unavailable items set to null or empty.

What I've done as a workaround is build my own type 24 decoder and route the incoming type 24 packets to my decoder instead of gpsd.  It looks to see whether the message is type A or B and handles / decodes it appropriately.  This more or less works but it's less than graceful.  I'd much rather enjoy the use of the professionally engineered, reliable gpsd than my own less worthy code.

My suggestion is that the gpsd developers accept that (regrettably) not all AIS feeds work the same and incorporate a way of handling unmatched type 24 messages.

If you choose not to do so I'll continue to use my workaround hack.  I understand that this request may not be a high priority.

If C was one of the languages that I'm competent with I'd offer to make the change myself but you don't want to deal with my level of C crafting in such a beautifully designed and implemented program.

I can provide a dump of thousands of type 24 messages that demonstrate what I receive if that would be helpful. 

I'm also happy to capture and send to you any other specific packet types that may be of interest or are rarely seen in the wild if I can find them in my feed.

Cheers and thanks to the developers / maintainers for all your excellent work.

Roy B

reply via email to

[Prev in Thread] Current Thread [Next in Thread]