Giter Club home page Giter Club logo

install-aiscatcher's Introduction

install-aiscatcher

This script does following:
(1) Clones AIS-catcher source-code from https://github.com/jvde-github/AIS-catcher
(2) Builds Linux executeable from source-code, & installs it in folder /usr/local/bin/
(3) Creates Systemd service to automatically start AIS-catcher when RPi boots, and run AIS-catcher in background.
(4) Provides Systemd commands to start stop, restart, and display status, and journalctl logs of AIS-catcher

Command to view Log:

sudo journalctl -u aiscatcher -n 20

INSTALL / UPGRADE / REINSTALL
Copy-paste following command in SSH console and press Enter key.
The script will Install / Upgrade / Reinstall Latest Version of AIS-catcher and it's Systemd Service.

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/abcd567a/install-aiscatcher/master/install-aiscatcher.sh)"


AFTER INSTALLATION IS COMPLETED, PLEASE DO FOLLOWING:

(1) If on RPi you have installed AIS Dispatcher or OpenCPN,
it should be configured to use UDP Port 10110, IP 127.0.0.1 OR 0.0.0.0

(2) Open file aiscatcher.conf by following command:

sudo nano /usr/share/aiscatcher/aiscatcher.conf     


The defalt content of above file are as shown below:

 -d 00000162
 -v 10
 -M DT
 -gr TUNER 38.6 RTLAGC off
 -s 2304k
 -p 3
 -o 4
 -u 127.0.0.1 10110
 -N 8383
 -N PLUGIN_DIR /usr/share/aiscatcher/my-plugins   


(3) In above file:
(a) Change 00000162 in "-d 00000162" to actual Serial Number of AIS dongle
(b) Change 3 in "-p 3" to the actual ppm correction figure of dongle
(c) Change 38.6 in "-gr TUNER 38.6 RTLAGC off" to desired Gain of dongle
(d) Add following line and replace xx.xxx and yy.yyy by actual values:
-N STATION MyStation LAT xx.xxx LON yy.yyy
(e) For each Site you want to feed AIS data, add a new line as follows:
-u [URL or IP of Site] [Port Number of Site]
(f) Save (Ctrl+o) and Close (Ctrl+x) file aiscatcher.conf

IMPORTANT: If you are Upgrading or Reinstalling, your old config file is saved as
/usr/share/aiscatcher/aiscatcher.conf.old

(4) REBOOT RPi ... REBOOT RPi ... REBOOT RPi ... REBOOT RPi

(5) See the Web Interface (Map etc) at
10.0.0.100:8383 (IP-of-PI:8383)

(6) Command to see Status sudo systemctl status aiscatcher

(7) Command to Restart sudo systemctl restart aiscatcher

(8) Command to Stop sudo systemctl stop aiscatcher


Determining the PPM Correction (for use in file aisctacher.conf)

(1) Install test software
sudo apt install rtl-sdr

(2) Determin the device index of the dongle for AIS-catcher by following command
rtl_test -t

(3) The device index will be 0 or 1, or 2 etc.
Use following command to determine ppm
NOTE: Replace n in command below by device index you found above
rtl_test -d n -p60

(4) Wait until the cumulative error value (in PPM) remains more-or-less the same for three consecutive minutes.
Note the last cumulative error value (in PPM) and use it in config of AIS-catcher.
For example if the value determined by above test is 7, the entry in config file will be -p 7


Logs:

Command to view full Log:

sudo journalctl -u aiscatcher -n 20

Commands to view specific parts of log:

Command:
sudo journalctl -u aiscatcher -n 200 | grep -o 'received.*'
Output:
received: 12 msgs, total: 59754 msgs, rate: 1.19834 msg/s

Command:
sudo journalctl -u aiscatcher -n 200 | grep -o 'rate.*'
Output:
rate: 1.29752 msg/s

Command:
sudo journalctl -u aiscatcher -n 30 | awk -F',' '{print $17}'
Output:
"ppm":4.340278

Command:
sudo journalctl -u aiscatcher -n 30 | awk -F',' '{print $16}'
Output:
"signalpower":-46.787212

In above command's last part, i.e. in {print $4}, substitute $4 by values listed in first column of the table below to get the output shown in second column of the table.

 

$n Output Example
$1 Jan 05 04:48:16 debian11 aiscatcher[38575]: [AIS engine v0.42 #0]
received: 16 msgs
Jan 05 04:48:17 debian11 aiscatcher[38575]: {"class":"AIS"
$2 "device":"AIS-catcher"
$3 "rxtime":"20230105095333"
$4 "scaled":true
$5 "channel":"A"
"channel":"B"
$6 "nmea":["!AIVDM
$7 3
$8 1
$9 4
$10 A
B
$11 14eIvM6P00rDSONHv0pf4?vR2@:2
8h30ot1?0@<BbDPPPP3D<oPPEU;M418T@00BbDPPPPC=DoN0lU:2WQ8v
$12 25C"]
0
02"]
$13 "signalpower":-41.644276
$14 "ppm":-3.761574
$15 "mmsi":316206000
$16 "status":5
$17 "status_text":"Aground"
"status_text":"Under way using engine"

 

To Uninstall AIS-catcher AND remove all its files

STEP-1: Stop & disable aiscatcher service, and remove aiscatcher service file.

sudo systemctl stop aiscatcher  

sudo systemctl disable aiscatcher  

sudo rm /lib/systemd/system/aiscatcher.service  

 

STEP-2: Remove files and folders pertaining to AIS-catcher.

sudo rm -rf /usr/share/aiscatcher

sudo rm /usr/local/bin/AIS-catcher

sudo userdel aiscat   

 

install-aiscatcher's People

Contributors

abcd567a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

install-aiscatcher's Issues

Stops sending data after a few minutes

Just setup a new install using this script. Shipxplorer USB dongle and DietPi Linux on an older Emachines PC

After a few minutes (seems to vary but around 15 minutes to 30 minutes) it stops updating positions on sites I send to (marinetraffic, findship).

systemctl restart aiscatcher fixes the issue until it decides to stop updating again.

Question is what's the best way to figure out what could be causing this? I am not too up on which logs or error messages to view to figure out what is happening.

Thanks in advance

Error Line 117

On trying the script and the original manual method, both give me an error. The issue on the script is Line 117.

git clone https://github.com/jvde-github/AIS-catcher.git

Seems to go part way then time out.

On a manual pull I get the following out put:

Cloning into 'AIS-catcher'...
remote: Enumerating objects: 21746, done.
remote: Counting objects: 100% (4386/4386), done.
remote: Compressing objects: 100% (1405/1405), done.
error: RPC failed; curl 56 GnuTLS recv error (-9): Error decoding the received TLS packet.
error: 4085 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: index-pack failed

Installation fails

I have 2 working stations using this install script.

I went to run this script again to get the lastest version, and 1 completed without a hitch and the other I am getting this error:

2024-05-24 14:01:33 (121 KB/s) - written to stdout [7003/7003]

Installing build tools and dependencies...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
cmake is already the newest version (3.18.4-2+deb11u1).
g++ is already the newest version (4:10.2.1-1).
gcc is already the newest version (4:10.2.1-1).
git is already the newest version (1:2.30.2-1+deb11u2).
make is already the newest version (4.3-4.1).
whiptail is already the newest version (0.52.21-4+b3).
libssl-dev is already the newest version (1.1.1w-0+deb11u1).
pkg-config is already the newest version (0.29.2-1).
librtlsdr-dev is already the newest version (0.6.0-3).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2+deb11u2).
libpq-dev is already the newest version (13.14-0+deb11u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Creating folder aiscatcher if it does not exist
Creating startup script file start-ais.sh
Writing code to startup script file start-ais.sh
Creating Service file aiscatcher.service
Entering install folder...
code exists
Updating code
Fetching origin
remote: Enumerating objects: 4618, done.
remote: Counting objects: 100% (4618/4618), done.
remote: Compressing objects: 100% (1522/1522), done.
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
error: 315 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: index-pack failed
error: Could not fetch origin
[ERROR] Error in line 134 when executing: git fetch --all

Not sure where to go from here

Thanks

Low performance when run as a service

Hi,

Do you have any idea why AIS-catcher may perform dramatically worse when run as a service versus running it manually? If I run it from bash, or with screen, or spawned at boot via rc.local, I get about 3.5 messages per second. When I run it as a systemd service, using the same settings, I get 1 to 1.5 messages per second. It uses approximately the same amount of CPU cycles as well, as reported by htop. I removed the Nice=-5 line from the unit file but that made no difference. I'm running this on a Raspberry Pi 3B+ running buster
image

upgrade not working

Hi,
Just upgrade to latest version using the standard install script

Version v0.59-354-g29cccb06
Build date Aug 3 2024
Engine AIS engine v0.59

got

AIS-catcher (build Aug  3 2024) v0.59-354-g29cccb06
(C) Copyright 2021-2024 jvde-github and other contributors
This is free software; see the source for copying conditions.There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Error: syntax error on command line with setting "#". setting does not start with "-"."

solved by removing all comment lines, so all lines with '#'
it works

Add option to save graph history

Restarting AIS-catcher typically erases history in the graphs. To retain plot "state" and backup the information to a file add in /usr/share/aiscatcher/aiscatcher.conf the following line:

-N FILE /usr/share/aiscatcher/my-stats/stat.bin BACKUP 60

Source

Files locked by read only

Im attempting to modify the config file, however all the files are locked behind read only and i am unable to modify the permissions.

Commands to view specific parts of log are changed

The values listed in first column of the table are changed.

Value for PPM is now $17:
sudo journalctl -u aiscatcher -n 30 | awk -F',' '{print $17}'
Output:
"ppm":4.340278

Value for Signal Power is now $16:
sudo journalctl -u aiscatcher -n 30 | awk -F',' '{print $16}'
Output:
"signalpower":-46.787212

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.