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

Error on AIS messages #84

Open
audiether opened this issue Mar 1, 2019 · 6 comments
Open

Error on AIS messages #84

audiether opened this issue Mar 1, 2019 · 6 comments

Comments

@audiether
Copy link

My NMEA stream contains AIS messages in the following format:

!AIVDM,1,1,,A,ENkb9ONaR@@@@@@@@@@@@@@@@@@;kaD09EE>`00003vP000,4*2C

When I try to parse this message I get a ParseError.

Any way to enable parsing AIS messages?

@Knio
Copy link
Owner

Knio commented Mar 5, 2019

Hi, unfortunately we don't have support for AIS messages. If you are able to help contribute code, or even just provide references and samples, it would be appreciated!

@audiether
Copy link
Author

I doubt I'll be able to contribute much in the way of code... I'm much more of a hack than an experienced programmer. :-)

I can definitely provide some sample messages and see what else I can find in the way of resources. I'm on the road and need to be on the boat to get the samples, so it will be about two weeks, but I will definitely post here.

THANK YOU for pynmea2!!!

@audiether
Copy link
Author

Here are the details on the data structure:
http://catb.org/gpsd/AIVDM.html

@klint-k
Copy link

klint-k commented Jul 11, 2019

try this github

https://github.com/schwehr/libais

@rtprio
Copy link

rtprio commented Oct 6, 2019

@Knio how would one structure the fact that ais messages can be more than one line? Keep track of the count and re-parse? I'm not sure one can assume the next line would be the next part of the message, but I haven't seen any examples otherwise.

>>> foo = pynmea2.parse("!AIVDM,2,1,6,B,56:fS:D0000000000008v0<QD4r0`T4v3400000t0`D147?ps1P00000,0*3")
>>> foo.is_complete
False
>>> foo.parse("!AIVDM,2,2,6,B,000000000000008,2*29")
>>> foo.is_complete
True

That's just getting the whole binary blob; I'm not exactly sure how to make it magically re-split when it comes time to .render() it again. It seems there are assumptions than the output is a single line again.

@xOneca
Copy link
Contributor

xOneca commented Oct 21, 2019

(Disclaimer: I have zero knowledge of AIS, but maybe I don't get too far)

I would let pynmea take care of the "transport" of the binary data in chunks, as it arrives. Then I would have an "upper stage" to which feed those blobs, and let it join and interpret the data as a whole.

For rendering, I would split the binary data in chunks and then encode each chunk in its own message. But this, again, using a first stage to split, and then pynmea (if it can) to encode them.

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

5 participants