2022年3月5日 星期六
[IR] 熱像儀的應用
2022年2月28日 星期一
2022年1月20日 星期四
[Python] 取代 pip search 的指令
由於XMLRPC 的濫用,因此 python.org 已經把使用 XMLRPC 的 pip search 永遠 banned 掉了。所以如果使用 pip search 會出現以下錯誤訊息。
```
ERROR: XMLRPC request failed [code: -32500]
RuntimeError:
PyPI's XMLRPC API is currently disabled due to unmanageable load and
will be deprecated in the near future. See https://status.python.org/
for more information.
```
還好有好心人寫了一個 script 的 wrapper 可以繼續簡單搜尋。步驟如下。
```
# 安裝
cd ~
git clone https://github.com/jeffmm/pypi-simple-search
cd pypi-simple-search
sudo make install
# 搜尋
pip-pss search foo
```
reference: https://stackoverflow.com/questions/66375972/getting-error-with-pip-search-and-pip-install
2021年12月29日 星期三
[RPi] 無中生有的 /dev/input/js0
今天在測試 Donkey Car 的搖桿,發現插上 2.4GHz 接收器竟然會變成 /dev/input/js1
因此 python3 manage.py drive --js 就讀不到搖桿資訊了,因為預設會使用 /dev/input/js0
還好這篇文章給了一些線索,可以使用 udevadm 指令去觀察這些裝置節點。
觀察結果如下。
$ sudo udevadm info /dev/input/js0
```
P: /devices/virtual/input/input4/js0
N: input/js0
L: 0
E: DEVPATH=/devices/virtual/input/input4/js0
E: DEVNAME=/dev/input/js0
E: MAJOR=13
E: MINOR=0
E: SUBSYSTEM=input
E: USEC_INITIALIZED=33222115
E: ID_INPUT=1
E: ID_INPUT_MOUSE=1
E: ID_SERIAL=noserial
```
$ sudo udevadm test-builtin input_id /class/input/js0
```
Load module index
Skipping empty file: /etc/systemd/network/99-default.link
Created link configuration context.
ID_INPUT=1
ID_INPUT_MOUSE=1
Unload module index
Unloaded link configuration context.
```
不過最有收穫的竟然還是使用 jstest 去測試
jstest /dev/input/js0
```
Driver version is 2.1.0.
Joystick (vnc-abspointer) has 2 axes (X, Y)
and 3 buttons (LeftBtn, RightBtn, MiddleBtn).
Testing ... (interrupt to exit)
Axes: 0:-32767 1:-32767 Buttons: 0:off 1:off 2:off
```
發現這 Joystick 是 vnc-abspointer,也就是因為啟動 VNC Server 之後跑出來的...
因此解決方法有三個。
1. 不要開啟 VNC Server。
2. 修改 donkeypart_ps3_controller/donkeypart_ps3_controller/part.py
把所有 /dev/input/js0 改為 /dev/input/js1 之後重新安裝。
3. 最簡單,把接收器插在 Pi 上以後重開機,HID 裝置會比 vnc-abspointer 早載入,因此會拿到 js0
2021年12月13日 星期一
[RPi] 控制伺服馬達
對於 Pi 控制伺服馬達,這兩篇寫的很清楚
* Raspberry Pi Servo Motor Control,範例 ==> 使用 RPi.GPIO
* Raspberry Pi PWM and Servo Motor Tutorial ==> RPi.GPIO 的 PWM 到 pigpio 範例
2021年11月27日 星期六
[Ubuntu] 更新 Google Chrome
今天想要測試 Colab,發現出現錯誤訊息 ```This site may not work in your browser. Please use a supported browser. ```,看來只能更新了。步驟如下。
1. Add Google Chrome PPA
```wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - ```
```sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' ```
2. Install or Upgrade Google Chrome
```sudo apt-get update ```
```sudo apt-get install google-chrome-stable ```
3. Launch Google Chrome
原本版本為 Version 70.0.3538.102 (Official Build) (64-bit),更新後為 Version 96.0.4664.45 (Official Build) (64-bit)
