Navigatrix.net - A Voyager's Companion http://navigatrix.net/ |
|
How to get dedicated AIS receiver to work with OpenCPN http://navigatrix.net/viewtopic.php?f=4&t=587 |
Page 1 of 1 |
Author: | Markus [ 18 Jan 2014, 17:09 ] |
Post subject: | How to get dedicated AIS receiver to work with OpenCPN |
From aboard s/v Victoria...trying to get their AIS ("easyAIS", http://www.easyais.de/en/product_page.php?prodid=15) to work with OpenCPN. It seems no matter what we do, OpenCPN under NX0.5 will only display one AIS target while GPSD shows more targets and OpenCPN under Windows also displays additonal targets. Here's what we have: dmesg tail after plugging in AIS via serial2USB converter: Code: [ 297.188510] usbserial: USB Serial support registered for generic [ 297.189253] usbcore: registered new interface driver pl2303 [ 297.189285] usbserial: USB Serial support registered for pl2303 [ 297.189325] pl2303 8-1:1.0: pl2303 converter detected [ 297.190312] usb 8-1: pl2303 converter now attached to ttyUSB0 [ 298.361514] pps_core: LinuxPPS API ver. 1 registered [ 298.361523] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]> [ 298.362046] pps_ldisc: PPS line discipline registered [ 298.362624] pps pps0: new PPS source usbserial0 [ 298.362643] pps pps0: source "/dev/ttyUSB0" added GPS plugged in subseqeuntly, showing up on /dev/ttyUSB1. gpspipe -w has both AIS and GPS showing up in the GPSD device list: Code: {"class":"VERSION","release":"3.6","rev":"3.6","proto_major":3,"proto_minor":7} {"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyUSB0", "activated":"2014-01-18T18:28:33.271Z","flags":9,"driver":"AIVDM", "native":0,"bps":38400,"parity":"N","stopbits":1,"cycle":1.00}, {"class":"DEVICE","path":"/dev/ttyUSB1","activated":"2014-01-18T18:28:36.304Z", "flags":1,"driver":"Generic NMEA","native":0,"bps":4800,"parity":"N", "stopbits":1,"cycle":1.00}]} {"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false, "timing":false} Filtering only 'AIS' sentences out of the subsequent gpspipe stream shows that there are at least two targets: Code: {"class":"AIS","device":"/dev/ttyUSB0","type":1,"repeat":0,"mmsi":232064000, "scaled":false,"status":0,"turn":0,"speed":1,"accuracy":false,"lon":91929148, "lat":-16350914,"course":3480,"heading":105,"second":51,"maneuver":0, "raim":false,"radio":163954} {"class":"AIS","device":"/dev/ttyUSB0","type":1,"repeat":0,"mmsi":235059368, "scaled":false,"status":0,"turn":0,"speed":145,"accuracy":true,"lon":91937745, "lat":-16184157,"course":3410,"heading":342,"second":50,"maneuver":0, "raim":false,"radio":69400} In OpernCPN, under Options -> Connections, we disabled the "/tmp/aisfifo" serial connection which we assume to be used for AIS via sound card. We then tried two different settings: [1] Only GPSD enabled -> Only the AIS target with MMSI 235059368 shows up [2] Added another connection as shown below: Attachment: options_connections.jpg [ 40.29 KiB | Viewed 11305 times ] Still only the 235059368 MMSI shows up. Kay from Victoria says he has tried this before with more than two targets showing up in OpenCPN under Windows while NX would only show one target. Any ideas/advice welcome. Is there anything in the "AIS via sound card" setup (/usr/local/bin/opencpnais) which we would need to disable for OpenCPN to work with a "normal" AIS? Many thanks! |
Author: | Moe [ 18 Jan 2014, 19:19 ] |
Post subject: | Re: How to get dedicated AIS receiver to work with OpenCPN |
/usr/local/bin/opencpnais creates the fifo port /tmp/ais and launches the small program gnuais which demodulates analogue soundcard input into digital ais data. Disabling/tmp/ais just means OpenCPN is not listening to anything from gnuais. Plugging in the ais box, and having the output show up in gpsd indicates gpsd is talking to /dev/ttyUSB0. Setting up OpenCPN to listen to /dev/ttyUSB0 could be setting up a struggle with gpsd for that port. xgps, has an ais panel that shows this data. Until today I was unaware gpsd could handle multipule inputs. If xgps show both gps/ais data from the multiple sources and OpenCPN with only gpsd activated still only displays one mmsi...it might be bad, buggy, weak, defective code in OpenCPN's gpsd implimentation. That is failure to demux the mixed stream. |
Author: | Markus [ 19 Jan 2014, 06:35 ] |
Post subject: | Re: How to get dedicated AIS receiver to work with OpenCPN |
Quote: If xgps show both gps/ais data from the multiple sources and OpenCPN with only gpsd activated still only displays one mmsi...it might be bad, buggy, weak, defective code in OpenCPN's gpsd implimentation. That is failure to demux the mixed stream. Many thanks, Moe. It seems that's what we have then, as GPSD is seeing both inputs (GPS and AIS) and multiple AIS targets. While I read yor reply I realized that we hadn't tried to disable the GPSD feed to OpenCPN and to only have it listen to /dev/ttyUSB0 (the AIS). Will try that next. If we do see more targets then it would be further indication of a buggy OpenCPN-GPSD interface and we can go bark up another tree... In the short term I wonder whether I can just emulate the gnuais output to /tmp/ais from gpsd via gpspipe and have OpenCPN listen to that. Will repprt back on any progress... |
Author: | Moe [ 19 Jan 2014, 08:05 ] |
Post subject: | Re: How to get dedicated AIS receiver to work with OpenCPN |
If OpenCPN isn't demuxing the data stream from gpsd, it might work to limit gpsd to the gps and have OpenCPN pick up the ais on a separate port. e.g., sudo killall gpsd gpsd -N -b -n /dev/ttyUSB1 # gps plugged in after EasyAIS and then set OpenCPN to pick up EasyAIS on /dev/ttyUSB0. If that does the trick, reconfigure gpsd to use /dev/ttyUSB1 and none other with sudo dpkg-reconfigure gpsd "Yes" and "Ok" to everything except... Answering the question: Device the GPS receiver is attached to: with /dev/ttyUSB1 Options: -n -b # (b) broken device safety mode and (n) Don't wait for a client to connect.... This preserves other application getting gps info concurrently by avoid clashing...at least that's the intent. The only downside is remembering the order of attachment so the gps gets tagged /dev/ttyUSB1. Someone had reported a similar problem a few months ago with OpenCPN not displaying AIS data from a known source. I hadn't considered a buggy OpenCPN. Good luck. |
Author: | Markus [ 21 Jan 2014, 05:46 ] |
Post subject: | Re: How to get dedicated AIS receiver to work with OpenCPN |
Quote: If that does the trick, reconfigure gpsd to use /dev/ttyUSB1 and none other with sudo dpkg-reconfigure gpsd "Yes" and "Ok" to everything except... Answering the question: Device the GPS receiver is attached to: with /dev/ttyUSB1 Options: -n -b # (b) broken device safety mode and (n) Don't wait for a client to connect.... Brilliant - that does the trick! Small addendum: in the GPSD configuration dialogue the second question, Code: Should gpsd handle attached USB GPS receivers automatically? needs to be answered with "No". Otherwise it will still keep OpenCPN from "seeing" the AIS data on /dev/ttyUSB0, despite this device not showing up in the GPSD device list. Everything else as per Moe's instructions above and it works like a charm. Thanks! |
Author: | Moe [ 21 Jan 2014, 06:57 ] |
Post subject: | Re: How to get dedicated AIS receiver to work with OpenCPN |
Thanks, Markus...glad you figured it out...and helped the Victorians. |
Page 1 of 1 | All times are UTC - 5 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |