2018年12月31日月曜日

A Setting of serial communication between Raspberry Pi 3 and device.

Raspberry Pi 3と、他のデバイスをSerial 通信する設定

ネットでいろいろ書いてあるのだけど、

結局、次の2ステップでOK

$ sudo raspi-config  > 5. Interfacing Options > P6 Serial > No > Yes


$ sudo vi /boot/config.txt

dtoverlay=pi3-disable-bt
 
この一行を加える。Bluetooth に割り当てられている serial を開放する。

OSのインストール直後の状態で確認した。

raspi-config の設定だけではダメで、config.txtへの追加が必要。


Peace!!

2018年12月30日日曜日

An Installation of lighttpd(1.4.52) on Raspberry Pi

Raspberry Piをコントローラに使っている自律走行系などのロボットのhttp通信は、lighttpdを使っているわけで

1.4.52をインストール

いろいろ試行錯誤してきたけど

aptでインストールできるバーションが、1.4.45になっているので素直に居れてバーションアップする方法が一番良いという事になってきた。

以前は、数年もメンテされていなかったlighttpdだけど最近はメンテが計画的に行われているようで安心して使える。

特に、Apatchに比べて早いし、柔軟性もあるので僕はlighttpdをロボット用では使う予定。


インストールの大まかな手順

・標準インストール ( sudo apt install lighttpd )
・lighttpd のページから最新版をdownloadしてmakeする
・環境設定

・エラーが起こった

追加:
違うRaspberry Piに、この手順でインストールしたら標準インストール、バージョンアップもエラー無しにできました。
最初のマシンの固有の問題かしら、、、

(1) 標準インストール

$ sudo apt install lighttpd

で、、、思いもよらないエラー


● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2018-12-30 09:55:42 JST; 28ms ago
  Process: 684 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)

$ ls -la /etc/lighttpd

drwxr-xr-x   2 root root  4096 Dec 30 09:55 conf-available
drwxr-xr-x   2 root root  4096 Jan 15  2017 conf-enabled

アレ? lighttpd.conf が無い

???  以前、lighttpd インストールしてremove したから、、、

sudo apt-get purge lighttpd
sudo apt-get autoremove lighttpd


それから、

sudo apt install lighttpd

ls /etc/lighttpd
ls /etc/lighttpd/conf*

systemctl status lighttpd 

● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset:
   Active: active (running) since Sun 2018-12-30 10:10:00 JST; 8min ago
 Main PID: 2250 (lighttpd)
   CGroup: /system.slice/lighttpd.service
           mq2250 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf

Dec 30 10:10:00 rcpm-r51 systemd[1]: Starting Lighttpd Daemon...
Dec 30 10:10:00 rcpm-r51 systemd[1]: Started Lighttpd Daemon.

ls -al /var/www
drwxr-xr-x  2 root root 4096 Jan 15  2017 cgi-bin
drwxr-xr-x  2 root root 4096 Dec 30 10:09 html

ブラウザーにアクセスしても、、、


という事で、標準インストールは、OK

(2) 最新版のビルド

最初にbuildに必要なモジュールのインストール

sudo apt-get install libpcre3-dev bzip2 libbz2-dev

https://www.lighttpd.net/    からダウンロード。因みに1.4.52でした。

展開し、ディレクトリーに入って

./configure
make
sudo make install

sudo systemctl restart lighttpd

念の為に、、、、え???

$ lighttpd -v
lighttpd/1.4.45 (ssl) - a light and fast webserver
Build-Date: Jan 14 2017 21:07:19

$ cat /lib/systemd/system/lighttpd.service
[Unit]
Description=Lighttpd Daemon
After=network.target

[Service]
Type=simple
ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

make install でインストールされる場所は、
/usr/local/sbin

buildした定義は

[Unit]
Description=Lighttpd Daemon
After=network-online.target

[Service]
Type=simple
PIDFile=/var/run/lighttpd.pid
ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
ExecReload=/bin/kill -USR1 $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target

という事で、最初のlighttpd.serviceを使うとして
/usr/sbinを/usr/local/sbinに変更

$ sudo systemctl daemon-reload
$ sudo systemctl restart lighttpd

$ lighttpd -v
lighttpd/1.4.45 (ssl) - a light and fast webserver
Build-Date: Jan 14 2017 21:07:19

???

$ /usr/local/sbin/lighttpd -v
lighttpd/1.4.52 - a light and fast webserver

意味不明なので、、、

残骸を消して
$ sudo rm r- /usr/lib/lighttpd

$ sudo reboot

$ lighttpd -v
lighttpd/1.4.52 - a light and fast webserver

本当に意味不明、、、、、でも時間が無いのでよし!

(3) 環境設定

/etc/lighttpd/lighttpd.conf

これはそのまま、、、

$ cd /etc/lighttpd/conf-available

$ vi 10-cgi.conf
$ cat 10-cgi.conf
# /usr/share/doc/lighttpd/cgi.txt

server.modules += ( "mod_cgi" )

$HTTP["url"] =~ "^/cgi-bin/" {
        cgi.assign = ( "" => "" )
}
$HTTP["url"] =~ "^/api/" {
        cgi.assign = ( "" => "" )
}

## Warning this represents a security risk, as it allow to execute any file
## with a .pl/.py even outside of /usr/lib/cgi-bin.
#
#cgi.assign      = (
#       ".pl"  => "/usr/bin/perl",
#       ".py"  => "/usr/bin/python",
#)

$ cd ../conf-enabled
$ sudo ln -s ../conf-available/10-cgi.conf
$ ls -al
10-cgi.conf -> ../conf-available/10-cgi.conf

$ sudo mkdir /var/www/api

・エラーが起こった

さぁこれで!  アドレスにアクセスするとエラー
動いていない

$ systemctl status lighttpd

Dec 30 13:57:21 rcpm-r51 systemd[1]: Starting Lighttpd Daemon...
Dec 30 13:57:21 rcpm-r51 systemd[1]: Started Lighttpd Daemon.
Dec 30 13:57:21 rcpm-r51 lighttpd[863]: 2018-12-30 13:57:21: (server.c.748) opening errorlog '/var/log/lighttpd/error.log' failed: No such file or directory
Dec 30 13:57:21 rcpm-r51 lighttpd[863]: 2018-12-30 13:57:21: (server.c.1454) Opening errorlog failed. Going down.
Dec 30 13:57:21 rcpm-r51 systemd[1]: lighttpd.service: Main process exited, code=exited, status=255/n/a
Dec 30 13:57:21 rcpm-r51 systemd[1]: lighttpd.service: Unit entered failed state.
Dec 30 13:57:21 rcpm-r51 systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Dec 30 13:57:21 rcpm-r51 systemd[1]: lighttpd.service: Service hold-off time over, scheduling restart.
Dec 30 13:57:21 rcpm-r51 systemd[1]: Stopped Lighttpd Daemon.

つまり、/var/log/lighttpd/error.log が無い

$ sudo mkdir /var/log/lighttpd
$ sudo chown www-data:www-data /var/log/lighttpd
$ sudo chmod 750  /var/log/lighttpd

でも、なんでかなぁ、、、

$ sudo systemctl restart lighttpd
$ sudo systemctl status lighttpd
$ systemctl status lighttpd

● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset:
   Active: active (running) since Sun 2018-12-30 14:15:08 JST; 9min ago
  Process: 1343 ExecStartPre=/usr/local/sbin/lighttpd -tt -f /etc/lighttpd/light
 Main PID: 1351 (lighttpd)
   CGroup: /system.slice/lighttpd.service
           mq1351 /usr/local/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf

Dec 30 14:15:08 rcpm-r51 systemd[1]: Starting Lighttpd Daemon...
Dec 30 14:15:08 rcpm-r51 systemd[1]: Started Lighttpd Daemon.

Peace!!













2018年12月27日木曜日

Centos7 mariDB インストールと設定

CentOS7にMariDBをインストールと設定

本当に書きたいことは、一番したなんだけどメモとして、、、

# yum install mariadb mariadb-server
#  vi /etc/my.cnf
    character-set-server=utf8
追加する

# systemctl enable mariadb.service
# systemctl start mariadb.service
# mysql_secure_installation

rootのパスワード入力以外はすべて、enter のみ

で、ここが問題で、

# [root@xxxxxxx~]]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

それで、パスワードをコマンドラインで続けて入力するとOKという落ち(笑)

[root@xxxxxxx~]# mysql -u root -pPASSWORD
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Peace!!

2018年12月1日土曜日

Lidar

手頃な価格のLidarが見つかりテスト

性能も、程々、、、
僕の用途では、十分な性能


もちろん、Raspberry Piで制御

Peace!!

展示会出展した

11月20日から22日まで、東京ビックサイトの
鳥獣害・ジビエ展の社団法人 猟協のブースで展示した。

低重心、フラットクローラ型


まだ、プロトタイプだけど、大きな反響いただきました。
傾斜地などの、足場の悪いところで、安全にモノを運ぶ
クローラ型の自律搬送ロボットです。
12月のイベントに向けて、更にブラッシュアップ。

もちろん、制御はRaspberry Piです。

Peace!!

2018年10月5日金曜日

最近の忙しいこと

な、、、なんと

倉庫管理システムを開発しているわけで、、、

サーバーはRaspberry Pi 3+

クライアントは、Android

いろいろあったけど、なんとか動き始めてきたきた

Androidでの、アプリは初めて、いきなりGoogleのmlkitも使い

Androidの作法も知らずに、大苦戦。

友人に頼んで、半日、ご紹介頂いたプロのレクチャーを受けて、

神を崇めるような、最高のレクチャーで、、、

僕も開眼できそうで、、、これからもAndroid開発続けようと

端末は、SONY Xperia XZ2 snapdragon 845

これが、また、爆速で、、、以前のAndroidモッサリ感がなくて、、、

Android 9developer previewを入れて、、、

9って、IOS的な操作になっていて、、、

でも、mlkitの重たい処理もはずも、サクサク

いよいよ、iPhoneはどんどん高くなるし、

業務系は、Androidだなぁと実感。

倉庫管理システムは、当然、自動搬送ロボットと連動するわけで、

そのロボットも10月末までにデモしなければ、、、

忙しいのか、何なのか、わからない状態で、、、

でも、一歩一歩進んでいるかなぁ、、、 

でも、昨日は、mariaDBにハマり。

今日は突破するぞ、、、

Peace!!

2018年9月18日火曜日

地方創生を妨げる、地方のプライドと意識

最近、某県でロボットを活用した地域創生の取組をしているけど、、、

やはり、地域の意識ってのが邪魔するなぁと、、、

「まぁ、これまでは何とかやってこれたから、

将来は解らないけど、ここしばらくは大丈夫」

これが、根底にある企業や人が、多いかも

企業は、昭和思考が抜けきれず、、、

特に、地方を代表する企業が、、、

言い方変えれば、その地方でしか活動できない企業

こういう企業が、「昭和の牛歩思考」で Unbelievable


良いも悪いも日本は、東京中心の政治や大企業で動いているわけで

チャンスを掴むには、それなりのやり方が必要

そして、スピード、、、


地方創生がうまくいかないのは、

「地方の鏡で、日本を写すから」

その鏡は、明日も、明後日も変わらないで居て欲しいという

見たい所しか見えないもの。

見たくない事を、見て認識しないと、チャンスは訪れない。


でも、みんなやっぱり自分の鏡で見たいわけで、、、

衰退する地方ほど、自分の鏡を離さない。

Peace!!