Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 11-01-2010, 15:59   #1
Registered User
 
hackoon's Avatar

Join Date: Jan 2010
Posts: 39
Lightbulb Improved GNUAIS (AISMON for Linux)

This is a improved version of gnuais to output on a fifo (/tmp/aisfifo)

copy gnuais.conf to /etc/
use sh opencpn.sh to start
or do
mkfifo /tmp/aisfifo
gnuais -c /etc/gnuais.conf

http://fserv.skill-club.com/get_1089_6de4.html

Works very well with a modified VHF. I've seen AIS targets at a distance of 200sm!!
hackoon is offline   Reply With Quote
Old 11-01-2010, 16:01   #2
Registered User
 
idpnd's Avatar

Join Date: Sep 2007
Location: Almería, ES
Boat: Chiquita 46 - Libertalia
Posts: 1,558
Nice, thanks for the wxtides hint at sourceforge as well.. have you tested the stations for accuracy? I had a look at a few and they don't look particularly accurate
__________________
sv Libertalia
idpnd is offline   Reply With Quote
Old 12-01-2010, 03:46   #3
Registered User
 
hackoon's Avatar

Join Date: Jan 2010
Posts: 39
some station are right others are not but it seems there is a difference between the calculation of wxtide and opencpn! As I wrote before I had to fill in a lot of zeros. The main difference between them seems to be the differens in level. try to compare a tide bettween the two... wxtide uses harmonics with less fields but I must confess I have no clue what all these fields mean. I told you it is a quickhack.
Have a look at the gnuais version maybe there is some way to integrate it in opencpn.
hackoon is offline   Reply With Quote
Old 12-01-2010, 09:06   #4
Registered User
 
idpnd's Avatar

Join Date: Sep 2007
Location: Almería, ES
Boat: Chiquita 46 - Libertalia
Posts: 1,558
The opencpn tides are from xtides, the differences can only be from the harmonics data used by wxtides.. Perhaps that could be improved upon by getting in touch with the wxtides publisher?

I think the AIS could be handled separately, most people seem to use dedicated boxes anyhow..
__________________
sv Libertalia
idpnd is offline   Reply With Quote
Old 12-01-2010, 16:25   #5
Registered User

Join Date: Dec 2009
Location: Vic Aust.
Boat: Seawind1160
Posts: 72
[
use sh opencpn.sh to start


Hackoon,

Thanks for your post.

Could you please repost the link to Opencpn.sh as it doesn't seem to work? Presumable the target address is similar to your second file link which did work for me.

I have tried gnuais already but unfortunately it wouldn't install properly - suspect a pathing problem for the logging files it creates - but I'm not experienced enough to rectify. Hopefully your version may do the trick.

R

Phil /OTYA
philocat is offline   Reply With Quote
Old 13-01-2010, 00:06   #6
Registered User

Join Date: Dec 2009
Location: Vic Aust.
Boat: Seawind1160
Posts: 72
Oops -Found the sh file zipped in the gnu download

R

Phil /OTYA[/QUOTE]
philocat is offline   Reply With Quote
Old 13-01-2010, 09:49   #7
Registered User
 
hackoon's Avatar

Join Date: Jan 2010
Posts: 39
lots of people I know of don't know that they can use vhf87 for ais. and even if they have dedicated AIS they normaly missing the antenna splitter and use a separate antenna usually mounted lower than the main antenna. While their main antenna at the mast top can cover up to (for me 200sm) a lower antenna cover less.
I think wxtide is not longer continued last version is from feb 2007. Anyway there is a difference with the tides between wxtide and opencpn (with my wxtide additions). So the calculations of opencpn or my adding of zeros must be wrong.
for make gnuais work you have to edit /etc/gnuais.conf

LogDir /tmp/
-> or any other place you have write access
SoundChannels both
-> or whatever is the wiring of you soundcable
hackoon is offline   Reply With Quote
Old 13-01-2010, 10:48   #8
Registered User
 
idpnd's Avatar

Join Date: Sep 2007
Location: Almería, ES
Boat: Chiquita 46 - Libertalia
Posts: 1,558
I might add the following useful resource for modifying VHF radios to get a feed for AIS purposes
__________________
sv Libertalia
idpnd is offline   Reply With Quote
Old 14-01-2010, 07:07   #9
Registered User
 
hackoon's Avatar

Join Date: Jan 2010
Posts: 39
for those who like to patch the orginal gnuais-0.2.0 here is the patch to make it output AIS on a serial port or a FIFO:

diff -Naur gnuais-0.2.0/src/ais.c gnuais-0.2.1/src/ais.c
--- gnuais-0.2.0/src/ais.c 2008-12-18 22:31:30.000000000 +0000
+++ gnuais-0.2.1/src/ais.c 2009-10-14 20:17:52.000000000 +0000
@@ -95,10 +95,10 @@

/* initialize the AIS decoders */
hlog(LOG_DEBUG, "Initializing demodulator A");
- rx_a = init_receiver('A', 2, 0);
+ rx_a = init_receiver('A', 2, 0, serial);
if (sound_channels != SOUND_CHANNELS_MONO) {
hlog(LOG_DEBUG, "Initializing demodulator B");
- rx_b = init_receiver('B', 2, 1);
+ rx_b = init_receiver('B', 2, 1, NULL);
channels = 2;
} else {
channels = 1;
diff -Naur gnuais-0.2.0/src/protodec.c gnuais-0.2.1/src/protodec.c
--- gnuais-0.2.0/src/protodec.c 2009-03-24 14:22:17.000000000 +0000
+++ gnuais-0.2.1/src/protodec.c 2009-10-14 23:53:26.000000000 +0000
@@ -19,7 +19,7 @@
#include <dmalloc.h>
#endif

-// #define DEBUG_NMEA
+#define DEBUG_NMEA
#ifdef DEBUG_NMEA
#define NMEA_DBG(x) x
#else
@@ -131,6 +131,8 @@
if (type < 1 || type > 9)
return;
unsigned long mmsi = protodec_henten(8, 30, d->rbuffer);
+// if (mmsi == 0)
+// return;
unsigned long imo;
unsigned int shiptype;
unsigned long day, hour, minute, second, year, month;
@@ -258,6 +260,7 @@
//In final. Add header "!" and trailer <cr><lf>
// here it could be sent to /dev/ttySx
serbuffer_l = snprintf(d->serbuffer, SERBUFFER_LEN, "!%s\r\n", d->nmea);
+
if (d->serial)
serial_write(d->serial, d->serbuffer, serbuffer_l);
NMEA_DBG(printf("NMEA: End of nmea->ascii-loop with sentences:%d sentencenum:%d\n",
@@ -271,7 +274,7 @@
if (d->seqnr > 9)
d->seqnr = 0;

- if (type < 0 || type > MAX_AIS_PACKET_TYPE)
+ if (type < 0 || type > 9)
return; // unsupported packet type

if (skip_type[type])
diff -Naur gnuais-0.2.0/src/receiver.c gnuais-0.2.1/src/receiver.c
--- gnuais-0.2.0/src/receiver.c 2008-12-18 22:26:34.000000000 +0000
+++ gnuais-0.2.1/src/receiver.c 2009-10-14 20:21:24.000000000 +0000
@@ -44,7 +44,7 @@

#define COEFFS_L 53

-struct receiver *init_receiver(char name, int num_ch, int ch_ofs)
+struct receiver *init_receiver(char name, int num_ch, int ch_ofs, struct serial_state_t *serial)
{
struct receiver *rx;

@@ -54,7 +54,7 @@
rx->filter = filter_init(COEFFS_L, coeffs);

rx->decoder = hmalloc(sizeof(struct demod_state_t));
- protodec_initialize(rx->decoder, NULL, name);
+ protodec_initialize(rx->decoder, serial, name);

rx->name = name;
rx->lastbit = 0;
diff -Naur gnuais-0.2.0/src/receiver.h gnuais-0.2.1/src/receiver.h
--- gnuais-0.2.0/src/receiver.h 2008-12-18 22:26:34.000000000 +0000
+++ gnuais-0.2.1/src/receiver.h 2009-10-14 20:22:22.000000000 +0000
@@ -19,7 +19,7 @@
int prev;
};

-extern struct receiver *init_receiver(char name, int num_ch, int ch_ofs);
+extern struct receiver *init_receiver(char name, int num_ch, int ch_ofs, struct serial_state_t *state);
extern void free_receiver(struct receiver *rx);

extern void receiver_run(struct receiver *rx, short *buf, int len);
hackoon is offline   Reply With Quote
Old 15-01-2010, 01:32   #10
Registered User

Join Date: Dec 2009
Location: Vic Aust.
Boat: Seawind1160
Posts: 72
Hackoon Thanks for the diff/patch.

How does the output of gnuais get to opencpn? Opencpn has four ports ttyS0-3 available in menu. Will sending output to one of these ports with gunais work directly with the patch or do you have to pipe / fifo via the mkfifo /tmp/aisfifo as per your script?

I have attached diary of my attempts so far to get ais working for anybody who wants a laugh and a few tips. My question above is rather academic until I get around my problems.

As an aside the following comments may be of interest which I picked up on the way:

Gnuais apparently doesnt have a good gmsk decoding algorithm. This is a bit over my head but it seems it basically only decodes a symbol at a time. With a noisy signal intersymbol overlaps can occur. A better method is apparently using a FIR prefilter feeding a viterbi decoder like the gsm phone systems. This looks at each possible symbol as they arrive and somehow historically adapts according to symbols either side of it as well- theory is well above me though. gnuradio does have this decoding method included. Although written both in python and C++ the code grunt bits seem relatively compact and isolatable and might be able to be swapped into the gnuais decoder with a little bit of programing. May result in a much more robust decoder. Should anyone want to take it on that would be great -I dont think I'm capable yet.

What about a hardware decoder? CML make a single chip engine CMX7042 which does the same as gnuais software after the vhf discrinminator tap. Chips cost AUD30 ea in lots of 10 from local supplier which may be able to be bettered. However their evaluation board is over the top at 850. I havent yet investigated how difficult it might be to use but it does have promise coupled with a pic microchip to avoid having the laptop on all the time for a 'ship in vicinity alarm system'. A firmware upload is be required which could be a gotcha.
Attached Files
File Type: doc arrgh.txt.doc (4.0 KB, 181 views)
philocat is offline   Reply With Quote
Old 15-01-2010, 10:00   #11
Registered User
 
hackoon's Avatar

Join Date: Jan 2010
Posts: 39
/tmp/aisfifo should come up as an option in AIS-config if you did mkfifo /tmp/aisfifo, if not try to put it in manualy
My expirience with gnuais is quite good at least as good as with aismon but feel free to improve it...
hackoon is offline   Reply With Quote
Old 27-01-2010, 09:13   #12
Registered User

Join Date: Jan 2010
Location: Philippines
Boat: Robert 35 Centre Cockpit
Posts: 65
Quote:
Originally Posted by hackoon View Post
/tmp/aisfifo should come up as an option in AIS-config if you did mkfifo /tmp/aisfifo, if not try to put it in manualy
My expirience with gnuais is quite good at least as good as with aismon but feel free to improve it...
rnfMLM1A


Hackoon,

I have had a brief look at the improved gnuais code and am fairly rutsy at compiling and working from source code.

But i love the way you have implemented it into Opencpn in the scriptfile.

i am not sure if i have to compile the source code and put the resulting file some where.

Would any of the below options be possible for you to assist new linux users.

Option One would it be possible to write a brief "how to" with steps on how to take your "Improved gnuais" download and make it work in linux. (I use Ubuntu)

Option 2 Could you create a .deb file to make it easy to install in Ubuntu or other debian Linux's.

option 3 Could it be packaged so that improved gnuais appears in the ubuntu Synaptic software installer.

I have a converted scanner that I used to use with AISMON and am quiet excited to try out your Linux version.


PS have you any idea how hard it wouldd be to have opencpn packaged for Ubuntu so as to appear in the synaptice software installer?

Regards

george
yachtmanforfun is offline   Reply With Quote
Old 27-01-2010, 11:45   #13
Registered User
 
hackoon's Avatar

Join Date: Jan 2010
Posts: 39
get http://fserv.skill-club.com/get_1115_5840.html

run "sh opencpn.sh" to start it
configure opencpn to use "/tmp/aisfifo" as AIS-INPUT


if the binary file don't work for you you can always try the source

./configure
make install

this will compile gnuais and install it in /usr/local/bin

I don't use ubuntu so can't provide deb files but the file should do the job.
hackoon is offline   Reply With Quote
Old 08-02-2010, 09:21   #14
Registered User
 
Tia Bu's Avatar

Join Date: Jul 2009
Location: South Carolina
Boat: 40' Jeanneau
Posts: 492
Discriminator mods

Hey guys:

Do you have to do the discriminator output mod to the radio to get this to work? I'm looking for an older vhf that has the duplex frequencies on channels 87 and 88. Is it worth trying a simple audio cable from the radio to the laptop before I crack open the radio and start soldering stuff?
Tia Bu is offline   Reply With Quote
Old 08-02-2010, 12:05   #15
Registered User
 
hackoon's Avatar

Join Date: Jan 2010
Posts: 39
Yes you definitely have to solder on older radios. Some newer ones have a discriminator output (I never seen one of these).
But its very easy to do. Just get a around 10K resistor and solder it to the chip. If your radio isn't listed in Discriminator Output you have to look for the microchip but easy to find normally. I tried with my own two radios (an older icom-handheld and some unknown fixed one) and it worked like a charm. I was less successful one some friends radio. the signal was shifted up and neither AISMON nor GNUAIS got it right. It added a lot of noise to the radio to. I couldn't solve the problem.
Maybe there is some radio-expert reading these lines who could give dome advice?
hackoon is offline   Reply With Quote
Reply

Tags
ais, linux


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Grib Viewer cagney Navigation 13 20-05-2010 17:51
Linux based Navigation Software for the eepc and XO laptop Barco Software Marine Electronics 36 03-09-2008 00:45
Anyone know of any boat Design Software for Linux ? steveh000 Construction, Maintenance & Refit 1 27-11-2007 06:56
OECS - Improved Yacht Security? GordMay Atlantic & the Caribbean 0 26-10-2006 11:06
linux or xp uncle_fred Navigation 7 21-08-2006 17:03

Advertise Here


All times are GMT -7. The time now is 11:14.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.