

Payload to a 6 bit boundary, ranging from 0 to 5. We’ll describe how to decode this in later sections.įield 7 (0) is the number of fill bits requires to pad the data Prescribe an interpretation of these but it’s obvious enough.įield 6 (177KQJ5000G?tO`K>RA1wUbN0TKH in this example) is the data In the wild, channel codes 1 and 2 may also be encountered the standards do not Side of the duplex from two VHF radio channels: AIS Channel A isġ61.975Mhz (87B) AIS Channel B is 162.025Mhz (88B). A sentence with a fragment count of 1 and aįragment number of 1 is complete in itself.įield 4 (empty in this example) is a sequential message ID forįield 5 (B in this example) is a radio channel code.

NMEA 0183’s 82-character maximum, so it is sometimes required to splitĪ payload over several fragment sentences.įield 3 (1 in this example) is the fragment number of this sentence. The payload size of each sentence is limited by !AIVDM,1,1,B,177KQJ5000G?tO`K>RA1wUbN0TKH,0*5Cįield 1, !AIVDM, identifies this as an AIVDM packet.įield 2 (1 in this example) is the count of fragments in the currentlyĪccumulating message. To answer the question posed, this is from the aforementioned site in that format: The AIVDM/AIVDO protocol decoding site contains the answer but there is a lot to sift through there. Starting from the json code, it should be easy to go on with further formatting and storing stuff. Print json.dumps(msg, indent=4, sort_keys=True)Īssuming that the nmea-samples file is in a data directory, you can filter out the line you want to show cat, head and tail. # make a json pretty print for each message # decode a file or somthing form the STDINį = open(sys.argv) if len(sys.argv) > 1 else sys.stdin # FutureWarning: The stream module is deprecated and will be removed in 1.0

I use json as a "clear text pretty printer". Here is some quick and dirty code in a script called test-ais.py to get the unix like head & tail behavoir. $ ls /usr/local/lib/python2.7/dist-packages/libais-0.16-py2.7-linux-x86_64.eggĪis _ais.py _ais.pyc _ais.so EGG-INFO test $ sudo python setup.py install # to deploy itĪfter all you should have the libraries in your python environment.

$ python setup.py build # to build the python stuff Download the data from $ cd YOUR_BUILD_PATHĪnd follow the installation instruction on/at the github page or run $ cd YOUR_BUILD_PATH/libais To get some code running, you need git a C++ compiler, the python setup environment, cmake. Here is a small howto running under LINUX and python 2.7. There you will find a decoder and documents to understand the nmea messages (mostly links menioned by the posts of and Dev). There is a good github repository of Kurt Schwehr who works at the Center for Coastal and Ocean Mapping (to track whale activities for example).
