引き続き緊急事態な1年でした。おうち時間が長いことから、お家周りについて色々計画から実行に移し、良い運気を呼び寄せた年だったかな。
年初の目標と結果は、
秋:データベーススペシャリスト(合格)
①は、達成です!体重が5kg落ちました。
②は、1個取得!もう1個は来年にお預けぢゃ。
> set type=ns
> osamuchan.com
Server: 2400:2411:5900:9900:1111:1111:1111:1111
Address: 2400:2411:5900:9900:1111:1111:1111:1111#53
Non-authoritative answer:
osamuchan.com nameserver = ns2-01.azure-dns.net.
osamuchan.com nameserver = ns3-01.azure-dns.org.
osamuchan.com nameserver = ns1-01.azure-dns.com.
osamuchan.com nameserver = ns4-01.azure-dns.info.
Authoritative answers can be found from:
ns1-01.azure-dns.com has AAAA address 2603:1061::1
ns2-01.azure-dns.net has AAAA address 2620:1ec:8ec::1
ns3-01.azure-dns.org has AAAA address 2a01:111:4000::1
ns4-01.azure-dns.info has AAAA address 2620:1ec:bda::1
ns1-01.azure-dns.com internet address = 40.90.4.1
ns2-01.azure-dns.net internet address = 64.4.48.1
ns3-01.azure-dns.org internet address = 13.107.24.1
ns4-01.azure-dns.info internet address = 13.107.160.1
>
$ nslookup
> set type=ns
> osamuchan.com
Server: 2400:2411:5900:9900:1111:1111:1111:1111
Address: 2400:2411:5900:9900:1111:1111:1111:1111#53
Non-authoritative answer:
osamuchan.com nameserver = ns-cloud-a2.googledomains.com.
osamuchan.com nameserver = ns-cloud-a4.googledomains.com.
osamuchan.com nameserver = ns-cloud-a1.googledomains.com.
osamuchan.com nameserver = ns-cloud-a3.googledomains.com.
Authoritative answers can be found from:
ns-cloud-a1.googledomains.com has AAAA address 2001:4860:4802:32::6a
ns-cloud-a2.googledomains.com has AAAA address 2001:4860:4802:34::6a
ns-cloud-a3.googledomains.com has AAAA address 2001:4860:4802:36::6a
ns-cloud-a4.googledomains.com has AAAA address 2001:4860:4802:38::6a
ns-cloud-a1.googledomains.com internet address = 216.239.32.106
ns-cloud-a2.googledomains.com internet address = 216.239.34.106
ns-cloud-a3.googledomains.com internet address = 216.239.36.106
ns-cloud-a4.googledomains.com internet address = 216.239.38.106
>
・市場価値を高めるとは「タグ付け」をすること・「タグ」を掛け合わせて、その掛け合わせの中の希少性を知ること
pi@raspberrypi:~ $ nano event_start.sh
GNU nano 3.2 event_start.sh
#!/bin/bash
#本シェルスクリプトの置いてあるディレクトリに移動(pythonがはくlogが適切に吐き出されるように。)
cd $(dirname $0)
#トークンを記述
token="xxxご自身のtokenを記載xxx"
#LINEにメッセージを送信
curl -X POST -H "Authorization: Bearer ${token}" -F "message = ラズパイからのメッセージstart" https://notify-api.line.me/api/notify
#ドローンを動かす。result.txtに直近実行のlogを吐けるようにしとく。
python /home/pi/Tello-Python/Single_Tello_Test/tello_test.py /home/pi/Tello-Python/Single_Tello_Test/flight_test2.txt 2>&1 | tee /home/pi/result.txt
#motionを一時停止。暴走しないように。後述。
curl http://localhost:8080/0/detection/pause
pi@raspberrypi:~ $ chmod +x event_start.sh
pi@raspberrypi:~ $ nano event_end.sh
GNU nano 3.2 event_end.sh
#!/bin/bash
#トークンを記述
token="xxxご自身のtokenを記載xxx"
#LINEにメッセージを送信
curl -X POST -H "Authorization: Bearer ${token}" -F "message = ラズパイからのメッセージend" https://notify-api.line.me/api/notify
pi@raspberrypi:~ $ chmod +x event_end.sh
pi@raspberrypi:~ $ sudo nano /etc/motion/motion.conf
GNU nano 3.2 /etc/motion/motion.conf
# %v = event, %q = frame number, %t = camera id number,
# %D = changed pixels, %N = noise level,
# %i and %J = width and height of motion area,
# %K and %L = X and Y coordinates of motion center
# %C = value defined by text_event
# %f = filename with full path
# %n = number indicating filetype
# Both %f and %n are only defined for on_picture_save,
# on_movie_start and on_movie_end
# Quotation marks round string are allowed.
############################################################
# Do not sound beeps when detecting motion (default: on)
# Note: Motion never beeps when running in daemon mode.
quiet on
# Command to be executed when an event starts. (default: none)
# An event starts at first motion detected after a period of no motion defined by event_gap
#; on_event_start value
on_event_start /home/pi/event_start.sh
# Command to be executed when an event ends after a period of no motion
# (default: none). The period of no motion is defined by option event_gap.
#; on_event_end value
on_event_end /home/pi/event_end.sh
# Command to be executed when a picture (.ppm|.jpg) is saved (default: none)
# To give the filename as an argument to a command append it with %f
; on_picture_save value
pi@raspberrypi:~ $ mkdir log
pi@raspberrypi:~ $ sudo motion
pi@raspberrypi:~ $ cat result.txt
id: 0
command: command
response: ok
start time: 2021-05-29 13:08:52.257217
end_time: 2021-05-29 13:08:52.315474
duration: 0.058257
id: 1
command: takeoff
response: ok
start time: 2021-05-29 13:08:52.315591
end_time: 2021-05-29 13:08:57.701102
duration: 5.385511
id: 2
command: flip b
response: ok
start time: 2021-05-29 13:08:59.703400
end_time: 2021-05-29 13:09:03.325487
duration: 3.622087
id: 3
command: flip f
response: ok
start time: 2021-05-29 13:09:05.327844
end_time: 2021-05-29 13:09:08.921326
duration: 3.593482
id: 4
command: flip l
response: ok
start time: 2021-05-29 13:09:10.923559
end_time: 2021-05-29 13:09:14.479949
duration: 3.55639
id: 5
command: flip r
response: ok
start time: 2021-05-29 13:09:16.482158
end_time: 2021-05-29 13:09:20.089971
duration: 3.607813
id: 6
command: land
response: ok
start time: 2021-05-29 13:09:22.092242
end_time: 2021-05-29 13:09:25.904518
duration: 3.812276
pi@raspberrypi:~/log $ ls
'2021-05-23 16:42:56.109620.txt' '2021-05-23 18:13:02.157302.txt'
'2021-05-23 17:30:33.422215.txt' '2021-05-23 18:13:52.863802.txt'
'2021-05-23 17:55:20.817894.txt' '2021-05-23 18:14:50.656453.txt'
'2021-05-23 17:58:11.359075.txt' '2021-05-29 13:07:00.454953.txt'
'2021-05-23 17:59:02.850064.txt' '2021-05-29 13:08:52.256574.txt'
'2021-05-23 17:59:53.879250.txt' '2021-05-30 12:15:42.879107.txt'
'2021-05-23 18:11:40.650572.txt'
pi@raspberrypi:~ $ curl http://localhost:8080/0/detection/pause #motion一時停止
pi@raspberrypi:~ $ curl http://localhost:8080/0/detection/start #motion再開
GNU nano 3.2 tello.py
import socket
import threading
import time
from stats import Stats
class Tello:
def __init__(self):
self.local_ip = ''
self.local_port = 8889
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # socke$
self.socket.bind((self.local_ip, self.local_port))
# thread for receiving cmd ack
self.receive_thread = threading.Thread(target=self._receive_thread)
self.receive_thread.daemon = True
self.receive_thread.start()
# self.tello_ip = '192.168.10.1' #Tello EDUのデフォルトのIPはコメントアウトしておく。
self.tello_ip = '192.168.xx.cc' #ここをTello EDUに振られたIPアドレスにしておく。
self.tello_port = 8889
self.tello_adderss = (self.tello_ip, self.tello_port)
self.log = []
self.MAX_TIME_OUT = 15.0
GNU nano 3.2 command.txt
command
takeoff
delay 5
land
GNU nano 3.2 command2.txt
command
takeoff
delay 2
land
GNU nano 3.2 flight_test.txt
command
takeoff
delay 2
left 20
delay 2
back 20
delay 2
right 20
delay 2
forward 20
delay 2
land
GNU nano 3.2 flight_test2.txt
command
takeoff
delay 2
flip b
delay 2
flip f
delay 2
flip l
delay 2
flip r
delay 2
land
GNU nano 3.2 flight_test3.txt 変更済み
command
takeoff
delay 2
up 50
delay 2
cw 360
delay 2
down 50
delay 2
ccw 360
delay 2
land
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ python tello_test.py command.txt
(詳細割愛)
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ python tello_test.py command2.txt
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ python tello_test.py flight_test.txt
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ python tello_test.py flight_test2.txt
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ python tello_test.py flight_test3.txt
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ python tello_test.py command2.txt
Traceback (most recent call last):
File "tello_test.py", line 13, in <module>
tello = Tello()
File "/home/pi/Tello-Python/Single_Tello_Test/tello.py", line 11, in __init__
self.socket.bind((self.local_ip, self.local_port))
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ ps -fA | grep python
pi 685 1 0 5月02 ? 00:00:00 /usr/bin/python3 /usr/share/system-config-printer/applet.py
pi 20201 20030 14 16:33 pts/0 00:00:33 python tello_test.py command2.txt
pi 20259 20030 0 16:36 pts/0 00:00:00 grep --color=auto python
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ sudo lsof -i:8889
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python 20201 pi 4u IPv4 469376 0t0 UDP *:8889
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ kill -9 20201
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ ps -fA | grep python
pi 685 1 0 5月02 ? 00:00:00 /usr/bin/python3 /usr/share/system-config-printer/applet.py
pi 20268 20030 0 16:38 pts/0 00:00:00 grep --color=auto python
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $
pi@raspberrypi:~/Tello-Python/Single_Tello_Test $ sudo lsof -i:8889
[1]+ 強制終了 python tello_test.py command2.txt