fulup-bzh / GeoGate

GeoGate is an opensource tracking GPS/AIS framework to implement GTS applications.
Apache License 2.0
74 stars 39 forks source link

Certain multi line ais do not decode correctly. #20

Closed Oritide closed 7 years ago

Oritide commented 7 years ago

Just had a ship go by that sent this message:

!AIVDM,2,1,9,A,53Moi:81Qk8LLpQH000PD98T@D4r118Tp<E=<0153@f594ke07TSm21D,0*63
!AIVDM,2,2,9,A,hF@000000000000,2*73

Unfortunately the decoder seemed to ignore a lot of the data and only output this:

AisDecode {
  bitarray: [],
  valid: false,
  payload: <Buffer 35 33 4d 6f 69 3a 38 31 51 6b 38 4c 4c 70 51 48 30 30 30 50 44 39 38 54 40 44 34 72 31 31 38 54 70 3c 45 3d 3c 30 31 35 33 40 66 35 39 34 6b 65 30 37 ... >,
  msglen: 56,
  channel: 'A' }
AisDecode {
  bitarray:
   [ 133, 131, 157, 183, 177, 138, 136, 129, 161, 179, 136, 156, 156, 184, 161, 152, 128, 128, 128, 160, 148, 137, 136, 164, 144, 148, 132, 186, 129, 129, 136, 164, 184, 140, 149, 141, 140, 128, 129, 133, 131, 144, 174, 133, 137, 132, 179, 173, 128, 135, 164, 163, 181, 130, 129, 148, 176, 150, 144, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 ],
  valid: false,
  payload: <Buffer 35 33 4d 6f 69 3a 38 31 51 6b 38 4c 4c 70 51 48 30 30 30 50 44 39 38 54 40 44 34 72 31 31 38 54 70 3c 45 3d 3c 30 31 35 33 40 66 35 39 34 6b 65 30 37 ... >,
  msglen: 71,
  channel: 'A',
  aistype: 5,
  repeat: 0,
  mmsi: '232649000',
  class: 'A' }
fulup-bzh commented 7 years ago

If this is a multi-frame message you need to let the decoder do not forget that you should provide a session object to store multi-part messages "Function AisDecode (input, session)"

See comment on https://github.com/SignalK/signalk-parser-nmea0183/issues/32

Oritide commented 7 years ago

@fulup-bzh I have a object for storing session and have had it work for all other multi line messages this is the first that has not worked

fulup-bzh commented 7 years ago

Then we have a bug, if you have a fix to propose, I would be more than happy to include it.

Oritide commented 7 years ago

Here is another one that doesn't decode fully from a different ship:

!AIVDM,2,1,6,A,53n>Nv82E:?thA<b2218tp`61=E10u9@E:2222162@e754rdR>0j0CQC,0*33
!AIVDM,2,2,6,A,8<M`1Sl`11Dm2CP,2*5D

I Think I have had this ship here before and it decoded fully unfortunately I did not save the message

fulup-bzh commented 7 years ago

Next time please store the message so we may reproduce the error.

Oritide commented 7 years ago

I have done some testing and it seems to be the AIS_version_indicator is not less than 2. at line 309: if( AIS_version_indicator < 2 ) { setting it to 3 or <= 2 makes it work not sure if this causes any issues elsewhere?

fulup-bzh commented 7 years ago

Well done, would need to check in the spec to understand what this is. I must say that I do not remember why I placed it to "2". Any idea what this indicator is ?

Oritide commented 7 years ago

Not sure your comments say: // Get the AIS Version indicator // 0 = station compliant with Recommendation ITU-R M.1371-1 // 1 = station compliant with Recommendation ITU-R M.1371-3 // 2-3 = station compliant with future editions

guessing the ships are using a slightly newer AIS Version and this was coded when it was only version 1?

Oritide commented 7 years ago

yeah looks like that has been updated https://www.navcen.uscg.gov/?pageName=AISMessagesAStatic says:

AIS version indicator 0 = station compliant with Recommendation ITU-R M.1371-1 1 = station compliant with Recommendation ITU-R M.1371-3 (or later) 2 = station compliant with Recommendation ITU-R M.1371-5 (or later) 3 = station compliant with future editions

fulup-bzh commented 7 years ago

It looks like we could just ignore this value, don't you think so ?

Oritide commented 7 years ago

I think so just looks like it is to say they are compliant with certain recommendations

fulup-bzh commented 7 years ago

If you move it out with a comment, I will merge your proposal.

afischerdev commented 7 years ago

I add a pull request. Hope to be not to fast with this.

fulup-bzh commented 7 years ago

Oritide I think this might be closed now, isn't it ? As you open it, I leave you to close it.