Navigatrix.net - A Voyager's Companion http://navigatrix.net/ |
|
How to make AIS-reciever Advansea RX-100 work with OpenCPN http://navigatrix.net/viewtopic.php?f=4&t=360 |
Page 1 of 1 |
Author: | HansValk [ 01 Feb 2013, 08:29 ] |
Post subject: | How to make AIS-reciever Advansea RX-100 work with OpenCPN |
Hello Navigatrix users, I have recently installed Navigatrix on an Acer Aspire One. Additionally I have tried to make an Advansea RX-100 AIS receiver work with OpenCPN. There is also a GPS attached, which is multiplexed via the RX-100. The RX-100 is connected to an USB-port of the Acer Aspire. With the GPS set to 'Network LIBGPS' and 4800 baud, the GPS signal comes through and a position is shown by OpenCPN on the map. In the AIS-toolbox window no USB-port is shown. There is als no baud-rate setting available. I've tried every one of the 7 ports, but no AIS-info shows on the map. Changing the GPS-toolbox settings to 38400 baud and setting the data source to 'AIS-port shared' results in losing the GPS-signal, but still no AIS-info is shown on the map. The strange thing is that xgps (also in the Navigatrix-package) DOES show AIS-information of ships in my vicinity, with names, positions etc. I have with the RX-100 a CD which contains a driver for Linux (ftdi_sio). Is it absolutely necessary to install this driver to get OpenCPN to recognize the RX-100? It's strange xgps can do the trick without a driver. It sees AIS-targets as well as GPS-satellites. How can OpenCPN be brought to recognize the RX-100 without losing the GPS-signal? -- greetings from the Netherlands, Hans Valk |
Author: | Moe [ 01 Feb 2013, 16:33 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
GPSD is a fabulous tool. It is essentially transparent. You plug in a gps and it works. You plug in a gps with ais and it works. You don't even have to set baud rates. It will figure it out. The problem is OpenCPN is not completely gpsd compliant. The way it connects to the gpsd is through the gpsd "library". In OpenCPN the gpsd interface is for a gpsd version that was replaced over 3 years ago. It was unchanged apparently for 'legacy' gpsd users or because it wasn't a high enough priority. The stable release of openCPN still lacks this capability. But I've noticed that the beta version of OpenCPN now has a complete gpsd interface. At this point it seems you have a number of options. You could turn off the gpsd and just run a straight connection to OpenCPN however that is done. The downside is that you won't have the gpsd to provide other time/location functions that normally does in Navigatrix. ....hang on a tick. I just thought of a hack that you could try to circumvent this problem. Give me some time (a day or so) to write it up and I'll get back you. |
Author: | HansValk [ 01 Feb 2013, 17:27 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
Moe wrote: Give me some time (a day or so) to write it up and I'll get back you. Thanks for picking this up, Moe. I suppose putting GPSD out of action means installing the already mentioned driver. That will also take some study, as I am no expert on Linux and working with the terminal window. It seems the new version of Open CPN won't very long, so maybe it will be here before the summer and the problem will be solved by a better version of the interface you mentioned. In the meantime I'm glad to wait for and try your 'hack'. -- Hans Valk |
Author: | Moe [ 03 Feb 2013, 07:04 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
Well this is a blind hack. I can't even see it stream via xgps because for me the data doesn't even come though the gpsd. I pick up AIS through the soundcard modem gnuais. ...but here goes. What this does is creates a virtual serial port from the gpsd that the AIS setting can pick up....in theory at least. In the terminal put the OpenCPN startup script in a safe place sudo cp -v /usr/local/bin/opencpnais /usr/local/bin/opencpnais.bak Open the text editor with superpowers sudo gedit /usr/local/bin/opencpnais Below is the blind hack. If you Select All <ctrl><a> and then Copy All <ctrl><c> Code: #!/bin/sh cd / if ( ! pidof opencpn ); then if [ ! -e /tmp/ais.lock ]; then sed -i -r "/Settings\/AISPort]/I{n; s/Port=.*/Port=Serial\:\/tmp\/ais.pty/}" ~/.opencpn/opencpn.conf sed -i "s/^Locale=.*$/Locale=${LANGUAGE%%:*}/" ~/.opencpn/opencpn.conf /usr/bin/gpspipe -r | socat - PTY,link=/tmp/ais.pty,raw & echo $!>/tmp/ais.lock fi /usr/local/bin/opencpn >/dev/null 2>&1 #/usr/local/bin/opencpn --verbose kill -9 $(cat /tmp/ais.lock) rm /tmp/ais.lock /tmp/ais.pty fi In the Text Editor you can Select All (<ctrl><a>) and then paste over the entire contents with Paste All (<ctrl><v>) Save the file (it should still executable) and give it a try. If it doesn't work. sudo mv -v /usr/local/bin/opencpnais.bak /usr/local/bin/opencpnais ...it will have only cost us our pride. |
Author: | HansValk [ 05 Feb 2013, 15:31 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
Moe wrote: Well this is a blind hack. I can't even see it stream via xgps because for me the data doesn't even come though the gpsd. I pick up AIS through the soundcard modem gnuais. ...but here goes. [cut] Save the file (it should still executable) and give it a try. If it doesn't work. sudo mv -v /usr/local/bin/opencpnais.bak /usr/local/bin/opencpnais ...it will have only cost us our pride. Thank for your time Moe. As far as I can see, I did exactly as you describe. I performed both of the 'sudo' commands and I replaced the code that comes up in gedit with the code you supplied and then saved it. After that the chart directory in OpenCPN was empty, so I had to put the right charts in again. The chart selection window shows much more than before: I actually had to look for the BSB-directory. After hooking up GPS and AIS-receiver as before, nothing seems changed. In the Network LIBGPS mode, a position shows on the map. In xgps the AIS-stream is visible as before, but nothing shows on the map. I tried all 7 ports again for AIS and switched around in the GPS-box (AIS-port shared, baud rates), but to no avail. Is it necessary to return to the original code I replaced? The replacement does not seem to hinder operation as is. You did not say anything on installing the supplied driver. What can be expected from doing that? -- greetings from the Netherlands, Hans Valk |
Author: | Moe [ 06 Feb 2013, 02:04 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
....well, that's odd. You should have had an AISport already pre-selected that was /tmp/ais.pty in the AIS tab of the Tools menu. The script creates the virtual port and pipe the raw data to it. It also re-writes ~/.opencpn/opencpn.conf...and says "Go here for ais data". It only deals with AIS in your setup. If you change to another input you could have trouble with AIS and the script would need to altered. The idea being gpsd ships the ais data (as we see in xgps) without any additional effort. We repeat that data stream in a virtual port...something OpenCPN can pick up. There should be no need to install a driver if you go through the gpsd. I'll take another look and see what's gone wrong. You are using the menu icon (or tool bar) to launch OpenCPN, right? |
Author: | Moe [ 06 Feb 2013, 02:34 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
Hans, I run the script, which is called by the menu and toolbar icons, and I get 9 ports to select from. The default is /tmp/ais.pty. If I change OpenCPN's configuration file the script changes it back. I considered the AIS Shared, but that is a one-way street, i.e., the gps will pick up the ais feed, but the ais feed won't talk to the gpsd. It's seems the best option is/was to pipe the gpsd data stream to a virtual port....let me see if there is an addition flag for only ais data from the gpsd; or if the the ais component of OpenCPN can parse the raw data stream from the gpsd (I was told it does; but does it? It might be the gps component can demux the raw data stream, but the ais component can't). Your needing to re-enter the chart data is also curious..... |
Author: | HansValk [ 08 Feb 2013, 09:33 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
Moe wrote: Hans, I run the script, which is called by the menu and toolbar icons, and I get 9 ports to select from. The default is /tmp/ais.pty. It's a little confusing. I've tried again, and the strange thing is that /tmp/ais.pty indeed shows up after starting OpenCPN a few times. It did not the first time I restarted, after making the changes you advised me. Now it does. Now the port shows up, no data reaches xgps. No GPS and no AIS-data. The AIS-receiver is still working; I see the led change when it receives data. Open CPN seems to remember it's chart directory as well. That said, it still does not work. The OpenCPN map does not show a position and also no AIS-data. -- Greetings from the Netherlands Hans Valk In addition: when I close OpenCPN and xgps and after that restart xgps I get AIS-data again, but no GPS-data. With the difference that the data-stream seems much slower than before I made the changes to the script. How does that figure? |
Author: | Moe [ 08 Feb 2013, 09:52 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
The gps setting in OpenCPN remains the same Network LIBGPS. If you point it, or anything else to the USB port that the gps is connected you will get a conflict. No data will flow. xgps will go silent. However, piping data from the gpsd using gpspipe as in the script, does not create a conflict. It is possible that the AIS component of OpenCPN cannot read raw data that is pipe to the virtual port created in /tmp/ais.pty; which should be the auto-magic setting. But first double check that the OpenCPN gps is looking at Network LIBGPS. Then verify that ais is set to /tmp/ais.pty. Ensure the data is going to xgps. If there is no data going to xgps then it might have been momentarily bewildered by the conflict created in adjusting openCPN. If xgps is silent; restart it. If it's still silents remove the USB, wait 10 seconds and re-insert it, and then check xgps. That will tell you the gpsd is picking up the data and shipping it which is crucial to test the virtual ais port. The next option would be to remove ,raw from the script /usr/local/opencpnais and see if it will pick up the data. ...and then....well, it just might not work for AIS with the tools we have using your setup. However, the way it is suppose to work is that it's just suppose to work...without tinkering around every time. It just the hassle of getting there. |
Author: | Moe [ 08 Feb 2013, 10:27 ] |
Post subject: | Re: How to make AIS-reciever Advansea RX-100 work with OpenC |
Another option... I don't know the form of the data that is coming off your RX-100. The -R flag on gpspipe: Quote: -R causes super-raw (gps binary) data to be output. This overrides NMEA and gpsd output modes. This would involve changing Line 8 Code: /usr/bin/gpspipe -r to an UPPER CASE R.And while I'm really grasping at straws... The original opencpnais script calls another script named comports. I did not include it into the hack because you weren't running any straight straight RS232 or bluetooth connections. It was giving me errors for I just left it out. For the life of me I cannot figure out why this would have any effect on anything....but if we have struck out with OpenCPN gps setting: Network LIBGPS; " ais setting:/tmp/ais.pty; ...and the entire thing called by the icons, or directly from the new opencpnais script...then re-insert it after the 4th line.... Code: if ( ! pidof opencpn ); then comports if [ ! -e /tmp/ais.lock ]; then I don't see how it would make any difference in the world, but wonders never cease; only my understanding of them does. |
Page 1 of 1 | All times are UTC - 5 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |