M0r13n / pyais

AIS message decoding and encoding in Python (AIVDM/AIVDO)
MIT License
176 stars 61 forks source link

Decoding AIS message type 5, class A static data #75

Closed anttinousiainen closed 2 years ago

anttinousiainen commented 2 years ago

I receive AIS messages on Icom m605 VHF radio and forward them to OpenCPN. All the targets around show fine and with full metadata there.

I decode the same stream of messages with pyais, log the messages and count the message types for statistics. However, it seems my counter for message type 5 (class A static data) seems to not increase, and my counter for decoding errors does. All the other message counts seem sane.

I have to dig into this deeper and catch few such messages in the wild, but anyone else has success with decoding said message type? It might of course be a problem on how Icom generates the NMEA messages/checksums etc, but it seems odd as OpenCPN seems to not have a problem as otherwise it could not show the ship names etc.

I will update this issue when I have some actual example messages to digest.

edit. here is an example message captured live from Icom that causes decoding error:

!AIVDM,2,1,3,A,53KPT5P00000tP7?KOTh4AV104lDh6222222220U1P5337<B05iRCS0CQ0kh,0*39

edit2. I can see it now, it is a multipart messege with second part missing for some reason. I will have to dig deeper, it might be my reception and not pyais problem at all.

edit3. It seems I found the problem. My NMEA multiplexer is interleaving the messages from AIS and GPS in a way that pyais does not seem to like - there is (almost) always a gnss sentence or two interleaved between multipart type 5 messages. OpenCPN seems to not care, but pyais does.

I think ultimately this is not a pyais issue. So this issue can be closed.

M0r13n commented 2 years ago

@anttinousiainen

My NMEA multiplexer is interleaving the messages from AIS and GPS in a way that pyais does not seem to like - there is (almost) always a gnss sentence or two interleaved between multipart type 5 messages. OpenCPN seems to not care, but pyais does.

Could you give me a minimal reproducible example? When using the streaming interfaces provided by pyais unknown messages/lines should simply be ignored. So there might be bug in pyais.

anttinousiainen commented 2 years ago

I can try - though I already fixed this on my end by only feeding pyais AIVDM messages.

I have a few Ublox F9 Gnss receivers configured for multiple moving baseline RTK (for boat heading), so some messages involved are rather esoteric and not likely to be encountered that often elsewhere... I would not really count it as a bug, if they mess up things :)