「RaspberryPiとDVB-TでADS-B」の版間の差分
(→FlightAware) |
(→FlightAware) |
||
171行目: | 171行目: | ||
フィーダIDを持ってない場合<br /> | フィーダIDを持ってない場合<br /> | ||
− | + | ここから先、登録済みで作業を進めたので新規登録の手順は不明 | |
=='''Flightradar24'''== | =='''Flightradar24'''== |
2019年4月28日 (日) 12:17時点における版
環境
ボード | Raspberry Pi 3 Model B |
OS | Raspbian Stretch with desktop 2019-04-08 |
ストレージ | SanDisk Ultra microSDHC Class10 16GB |
DVB-T | TV28Tv2DVB-T(R820T) |
アンテナ | ダイヤモンド D555 120MHz/1090MHz帯受信専用 |
その他 | MCX-P/SMA-J変換ケーブル ダイヤモンド 2D1SR M-SMA変換ケーブル ダイヤモンド BK10 モービルアンテナ取付金具 |
具合
- リソースの具合 IoT MONITOR 別窓
- 延命対策しないと数ヵ月でSDカードが壊れる感じ
準備
OS
「Raspbian インストール」などで検索
省略
IP固定
「Raspberry Pi Strech IP固定」などで検索
$ sudo nano /etc/dhcpcd.conf
末尾に追記
interface eth0
static ip_address=192.168.1.183/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
ホスト名
Menu > 設定 > RaspberryPiの設定 > システムタブ > ホスト名 fr24 OK > 再起動
遠隔操作
運用にモニター、マウス、キーボードは必要ないので遠隔操作にする
標準で入っているRealVNCを使用
VNC有効
Menu > 設定 > RaspberryPiの設定 > インターフェイスタブ > VNC有効 > OK
解像度の変更
Menu > 設定 > RaspberryPiの設定 > システムタブ > 解像度 > 1280x960程度 > OK > 再起動
シャットダウンし、モニター、マウス、キーボードを取り外して電源入れ直し
WindowsPCなどのVNCクライアントから接続を試す
成功していれば、以降はVNCクライアントの窓の中で作業
方向性
全てのアプリがdump1090からメトリクスを取得して動く
dump1090の歴史順
古 dump1090-antirez dump1090-MalcolmRobb dump1090-mutability dump1090-fa 新
Flightradar24はMalcolmRobbを採用してるようだけど、
mutability作者は「もうサポートできないからdump1090-faを使ってくれ!」って言ってる。
先にdump1090-faのFlightAwareをインストールし、他はdump1090-faにつなぐのが順当に見える。
FlightAware
参考: PiAware - dump1090 ADS-B integration with FlightAware ✈ FlightAware
インストール
$ wget http://ja.flightaware.com/adsb/piaware/files/packages/pool/piaware/p/piaware-support/piaware-repository_3.6.3_all.deb
$ sudo dpkg -i piaware-repository_3.6.3_all.deb
$ sudo apt-get update
$ sudo apt-get install piaware
$ sudo piaware-config allow-auto-updates yes
$ sudo piaware-config allow-manual-updates yes
$ sudo apt-get install dump1090-fa
$ sudo reboot
動作確認
RaspberryPiの場合 http://127.0.0.1:8080 他のPCの場合 http://192.168.1.183:8080
設定を変更する場合
$ sudo leafpad /usr/share/dump1090-fa/html/config.js
統計確認
https://flightaware.com/adsb/stats/user/<username>
フィーダIDを持っている場合
https://ja.flightaware.com/adsb/piaware/upgrade
sudo piaware-config feeder-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx sudo systemctl restart piaware
フィーダIDを持ってない場合
ここから先、登録済みで作業を進めたので新規登録の手順は不明
Flightradar24
事前に用意
- メールアドレス 例: abc@gmail.com
- sharingkey(新規の場合は必要なし)
- アンテナの緯度 例: 35.xxxx
- アンテナの経度 例: 139.xxxx
- アンテナの海抜 例: 海抜+設置高さ=xx (単位feet)
インストール
$ sudo bash -c "$(wget -O - https://repo-feed.flightradar24.com/install_fr24_rpi.sh)"
赤字が入力
Welcome to the FR24 Decoder/Feeder sign up wizard! Before you continue please make sure that: 1 - Your ADS-B receiver is connected to this computer or is accessible over network 2 - You know your antenna's latitude/longitude up to 4 decimal points and the altitude in feet 3 - You have a working email address that will be used to contact you 4 - fr24feed service is stopped. If not, please run: sudo systemctl stop fr24feed To terminate - press Ctrl+C at any point Step 1.1 - Enter your email address (username@domain.tld) $:メールアドレス Step 1.2 - If you used to feed FR24 with ADS-B data before enter your sharing key. If you don't remember your sharing key, pelase use the retrival form: https://feed.flightradar24.com/forgotten_key.php Otherwise leave this field empty and continue. $:既得のsharingkey(新規の場合は空エンター) Step 1.3 - Would you like to participate in MLAT calculations? (yes/no)$:yes IMPORTANT: For MLAT calculations the antenna's location should be entered very precise! Step 3.A - Enter antenna's latitude (DD.DDDD) $:35.xxxx Step 3.B - Enter antenna's longitude (DDD.DDDD) $:139.xxxx Step 3.C - Enter antenna's altitude above the sea level (in feet) $:xx.x Using latitude: 35.xxxx, longitude: 139.xxxx, altitude: xx.xft above sea level Validating email/location information...OK The closest airport found is ICAO:RJTT IATA:HND near Tokyo. Latitude: 35.xxxxxx Longitude: 139.xxxxxx Country: Japan Flightradar24 may, if needed, use your email address to contact you regarding your data feed. Would you like to continue using these settings? Enter your choice (yes/no)$:yes We have detected that you already have a dump1090 instance running. We can therefore automatically configure the FR24 feeder to use existing receiver configuration, or you can manually configure all the parameters. Would you like to use autoconfig (*yes*/no)$:yes Step 6A - Please select desired logfile mode: 0 - Disabled 1 - 48 hour, 24h rotation 2 - 72 hour, 24h rotation Select logfile mode (0-2)$:0 Step 6B - Please enter desired logfile path (/var/log/fr24feed): $:空エンター Submitting form data...OK Congratulations! You are now registered and ready to share ADS-B data with Flightradar24. + Your sharing key (xxxxxxxxxxxxxxxx) has been configured and emailed to you for backup purposes. + Your radar id is T-RJTTxxx, please include it in all email communication with us. + Please make sure to start sharing data within one month from now as otherwise your ID/KEY will be deleted. Thank you for supporting Flightradar24! We hope that you will enjoy our Premium services that will be available to you when you become an active feeder. To start sending data now please execute: sudo systemctl start fr24feed Saving settings to /etc/fr24feed.ini...OK Installation and configuration completed!
サービス起動
$ sudo systemctl start fr24feed
動作確認
RaspberryPiの場合 http://127.0.0.1:8754 他のPCの場合 http://192.168.1.183:8754
Flightradar24 Premium
https://www.flightradar24.com/premium/
ここから先、登録済みで作業を進めたので新規登録の手順は不明
RadarBox
参考: Radarbox24 Raspberry Pi Client
インストール CATEGORY A
$ sudo bash -c "$(wget -O - http://apt.rb24.com/inst_rbfeeder.sh)"
再起動
$ sudo reboot
ここから先、登録済みで作業を進めたので新規登録の手順は不明
sharing keyの確認
$ sudo rbfeeder --showkey --no-start
sharing keyの登録
https://www.radarbox24.com/raspberry-pi/claim
Plane Finder
最新版のバージョン確認
https://planefinder.net/sharing/client
Linux ARMHF (Raspberry Pi, BeagleBone, Radarcape etc.)のDebian Package(.deb)のURL
インストール x.x.xxバージョン変更
$ wget http://client.planefinder.net/pfclient_x.x.xx_armhf.deb
$ sudo dpkg -i pfclient_x.x.xx_armhf.deb
ブラウザで設定
RaspberryPiの場合 http://127.0.0.1:30053 他のPCの場合 http://192.168.1.183:30053
- メールアドレス 例: abc@gmail.com
- アンテナの緯度 例: 35.xxxx
- アンテナの経度 例: 139.xxxx
Create a new sharecode (メールにsharecodeが届きます。)
- Receiver data format: Beast
- IP address: 127.0.0.1
- Port: 30005
Complete configuration
動作確認
RaspberryPiの場合 http://127.0.0.1:30053 他のPCの場合 http://192.168.1.183:30053
Nginx
JSONの外部参照でCANVAS汚染しました。
lighttpdにproxyするCORS対策するだけのnginxを作ってみます。
nginx port 50000 >> lighttpd dump1090-fa port 8080 nginx port 50001 >> lighttpd Plane Finder port 30053
停止
$ sudo service lighttpd stop
インストール
$ sudo apt-get install nginx $ sudo /etc/init.d/nginx start
デフォルトのシンボリックリンク削除
$ sudo unlink /etc/nginx/sites-enabled/default
設定作成
/etc/nginx/nginx.confでincludeになっているのでhttpディレクティブは必要無し
$ sudo nano /etc/nginx/sites-available/proxy
server { listen 50000; server_name localhost; location / { return 403; } location = /data/aircraft.json { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "POST, GET, OPTIONS"; add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; add_header Access-Control-Allow-Credentials true; proxy_pass http://127.0.0.1:8080/data/aircraft.json; } } server { listen 50001; server_name localhost; location / { return 403; } location = /ajax/aircraft.json { #add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "POST, GET, OPTIONS"; add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; add_header Access-Control-Allow-Credentials true; proxy_pass http://127.0.0.1:30053/ajax/aircraft.json; } }
保存: Ctrl + o > リターン
終了: Ctrl + x
シンボリックリンク
$ sudo ln -s /etc/nginx/sites-available/proxy /etc/nginx/sites-enabled/
再起動
$ sudo reboot
確認
http://192.168.1.183:50000/data/aircraft.json http://192.168.1.183:50001/ajax/aircraft.json
MyRadar24
不具合あり
3Dビューワーを作ってみました。
dump1090-faのサブディレクトリで起動するよう設定してみます。
MyRadar24 動作サンプル
install
ダウンロード version0.6
$ wget http://dz.plala.jp/wiki_data/myradar24v0.6.zip
$ unzip myradar24v0.6.zip
登録
$ sudo mkdir /usr/share/dump1090-fa/html/3d
$ sudo cp -R myradar24v0.6/. /usr/share/dump1090-fa/html/3d/
設定
$ sudo leafpad /usr/share/dump1090-fa/html/3d/js/script.js
書き換え
(事前にBingMapsのbasic keyを取得してください。既にFlightAware dump1090で使用してる場合、同じものが使用できます。)
// Controls page title, righthand pane when nothing is selected
PageName = "MyRadar24";
// Provide a Bing Maps API key here to enable the Bing imagery layer.
// You can obtain a free key (with usage limits) at
// https://www.bingmapsportal.com/ (you need a "basic key")
var BingMapsAPIKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
var myLat = 35.xxxx;
var myLon = 139.xxxx;
var standardTime = 'JST'; //Standard Time spell
var offsetTime = '+9'; // UTC offset Decimal https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
var removeTime = 10; //Time to delete from lost (s)
動作確認
http://192.168.1.183:8080/3d/ (FlightAware dump1090のローカルIPアドレスに/3d/を加えたもの)
ローカルエリア内の他のPCは動作しました。 RaspberryPiのChromiumはCORSエラーが出ました。CORS対策してもWebGLエラーが出ました。 結果、RaspberryPiのブラウザで操作することはできない気がします。
カメラのデフォルト位置の調整
MyRadar24を起動してる状態でSpaceキーを押すと画面に数値が表示されます。 (もう一度押すと消えます。) マウス操作して理想の場所まで移動。
カメラのデフォルト位置の設定
$ sudo leafpad /usr/share/dump1090-fa/html/3d/js/script.js
書き換え
// Default camera position (play and space key press)
var camLon = 139.8256;
var camLat = 35.6959;
var camDist = 138434;
var camPan = -0.027;
var camTilt = 1.055;
uninstall
$ rm myradar24v0.6.zip
$ rm -r myradar24v0.6
$ sudo rm -r /usr/share/dump1090-fa/html/3d
airport data
設定済データの確認
$ sudo leafpad /usr/share/dump1090-fa/html/3d/json/airports.json
データのダウンロード
http://ourairports.com/data/
airports.csvをダウンロード。
MicrosoftExcelやLibreOfficeなどで開き内容確認。
あまりに量が多いため全てを登録するとMyRadar24は動かなくなります。
2行目から最終行までを選択しiso_countryの列でデータの並び替え。
不必要な国の行を全て削除。
それでもデータ量が多いようであればtype列でデータの並び替えをし、heliportの行など削除。
データをCSVで保存。
オンラインサービスでCSVからJSONに変換
http://www.csvjson.com/csv2json
出来たJSONデータを新規テキストに貼り付け。
行の頭に以下追加
{ "airport": [
最終行に以下追加
] }
保存しairports.jsonにリネーム。
/usr/share/dump1090-fa/html/3d/json/airports.jsonを上書き保存。
延命対策
swap
無効化
Stretchの場合
$ sudo dphys-swapfile swapoff $ sudo systemctl stop dphys-swapfile $ sudo systemctl disable dphys-swapfile
fstab
設定
$ sudo nano /etc/fstab
nodiratime追記と末尾に追記
参考: fstab - ArchWiki atime オプション
PARTUUID=5cfaeb3f-02 / ext4 defaults,noatime,nodiratime 0 1 tmpfs /tmp tmpfs defaults,noatime,nodiratime,mode=1777 0 0 tmpfs /run/user/1000 tmpfs defaults,noatime,nodiratime,mode=1777 0 0 tmpfs /run/dump1090-fa tmpfs defaults,noatime,nodiratime,mode=1777 0 0 tmpfs /run/piaware tmpfs defaults,noatime,nodiratime,mode=1777 0 0 tmpfs /home/pi/.cache/lxsession/LXDE-pi tmpfs defaults,noatime,nodiratime,mode=1777 0 0
保存: Ctrl + o リターン
終了: Ctrl + x
再起動
$ sudo reboot
確認
$ df -h
systemctl
確認
$ systemctl list-unit-files -t service|grep enabled
rsyslog停止
$ sudo systemctl stop rsyslog.service $ sudo systemctl disable rsyslog.service 戻すなら $ sudo systemctl enable rsyslog.service
bluetooth停止
$ sudo systemctl stop hciuart.service $ sudo systemctl stop bluetooth.service $ sudo systemctl disable hciuart.service $ sudo systemctl disable bluetooth.service 戻すなら $ sudo systemctl enable hciuart.service $ sudo systemctl enable bluetooth.service
再起動
$ sudo reboot
確認
$ systemctl list-unit-files -t service $ systemctl list-unit-files -t service|grep disabled
folder2ram
RAMディスク化
インストール
$ sudo wget -O /sbin/folder2ram https://raw.githubusercontent.com/bobafetthotmail/folder2ram/master/debian_package/sbin/folder2ram $ sudo chmod +x /sbin/folder2ram $ sudo folder2ram -configure will now open the configuration file with your favourite text editor write its name and press enter (nano, vim, gedit are the most common) リターン
$ sudo nano /etc/folder2ram/folder2ram.conf
末尾に追記
tmpfs /var/log tmpfs /var/tmp tmpfs /var/spool tmpfs /var/cache/samba
保存: Ctrl + o > リターン
終了: Ctrl + x
$ sudo folder2ram -mountall $ sudo folder2ram -enablesystemd
再起動
$ sudo reboot
確認
$ df -h
journald
$ sudo nano /etc/systemd/journald.conf
追記
Storage=none
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
sysctl
Netdataでsoftnetの警告が必ず出る
過去10分間に、ksoftirqがsysctl net.core.netdev_budgetまたはnet.core.netdev_budget_usecsを使い果たし作業が残っている。これはパケットがドロップされる原因となる可能性があります。
参考: Red Hat Enterprise Linux Network Performance Tuning Guide
参考: Can't fix persistent 'netdev budget ran outs' with 45k alerts, need help #4624
設定
$ sudo nano /etc/sysctl.conf
末尾に追記
net.core.netdev_budget_usecs=20000
保存: Ctrl + o > リターン
終了: Ctrl + x
再起動
$ sudo reboot
更新履歴
- 2019.2.8 書き直し
- 2018.1.4 公開