Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NMEA0183 Library Extension for encoding AIS #13

Open
ronzeiller opened this issue Oct 29, 2019 · 5 comments
Open

NMEA0183 Library Extension for encoding AIS #13

ronzeiller opened this issue Oct 29, 2019 · 5 comments

Comments

@ronzeiller
Copy link

Do not know if this is the right place for this:
Is it somewhere already, or are there any plans, or is there somebody working on NMEA2000 AIS PGNs converting to "NMEA" !AIVDM sentences yet?

@ronzeiller
Copy link
Author

ronzeiller commented Nov 3, 2019

Hi Timo,

So I have started an Addendum to NMEA0183 library for AIS encoding from parsed N2k values from ParseN2kPGN129038, which is Type 1: Position Report Class A to start with:

https://github.com/ronzeiller/NMEA0183/tree/ais-development
Edit: AIS is now made as separated Add On and not within the NMEA0183 Library
https://github.com/ronzeiller/NMEA0183-AIS

Even if it is far from a Pull Request, it is working code.
I will try to code an example for Arduino, which is extra work, because I am using Atom/PlatformIO.

Before I continue with encoding other sentences, would you like to have a look and comment on the code?

@ronzeiller ronzeiller changed the title !AIVDM (AIS) sentences from NMEA2000? NMEA0183 Library Extension for encoding AIS Nov 3, 2019
@ronzeiller
Copy link
Author

ronzeiller commented Nov 3, 2019

Example: https://github.com/ronzeiller/NMEA0183/tree/ais-development/Examples/NMEA2000ToNMEA0183AIS
added.

One Issue I found: the COG is not correct.
Have to figure out what the ParseN2kPGN129038 is delivering, degrees or radiant?

Because I now for sure, that this ferry boat was sailing COG around 260°... :-)

IMG_0184s

I got from N2kParser:

Name Value --> AIS Value
REPEAT = 0 --> 0
UserID = 238991940 --> 238991940
NavStatus = 0 --> 0
ROT = 0.00 --> 0
SOG = 5.81 --> 58
Accuracy = 0 --> 0
Longitude = 15.23 --> 9136800 --> 0000100010110110101010100000
Latitude = 44.08 --> 26449399 --> 001100100111001010111110111
COG = 4.75 --> 47
Heading = 1.45 --> 1
RAIM = 0
!AIVDM,1,1,,A,13SrrA000r15eE0I>Euh;h3h0000*5B

@ttlappalainen
Copy link
Owner

4.75 rad = 272 deg.

I checked and it should be right on ParseN2kPGN129038 and returns radians.

I tried to keep all units in SI, but unfortunately originally did not fix that to lat/lon, which are in degrees. There are also some other inconsistense. All angles except lat/lon should be in radians.

@ronzeiller
Copy link
Author

Type 1 Class A Position Report should work now with all units corrected.

@ronzeiller
Copy link
Author

ronzeiller commented Nov 20, 2019

Working NMEA0183 Library Add On for converting:
NMEA2000 PGN 129038 => AIS CLASS A Position Report, Message Type 1
NMEA2000 PGN 129039 => AIS Class B Position Report, Message Type 18
NMEA2000 PGN 129794 => AIS Class A Ship Static and Voyage related data, Message Type 5
NMEA2000 PGN 129809 => AIS Class B "CS" Static Data Report, making a list of UserID (MMSI) and Ship Names used for Message 24 Part A
NMEA2000 PGN 129810 => AIS Class B "CS" Static Data Report, Message 24 Part A+B

can be found here:
https://github.com/ronzeiller/NMEA0183-AIS

There is lot's to might be improved....
So any suggestions and/or Pull Requests are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants