若不想一天到晚重灌系windows系統. 那麼這個功能是一定要啓用的~
2020年12月14日 星期一
2020年11月27日 星期五
TelegramBot 傳送貼圖的方法
TelegramBot 傳送圖片的方法
def start(update: Update, context: CallbackContext) -> None:
update.message.reply_text('Hi!')
update.message.reply_sticker('http://e2412fdcd657.ngrok.io/sticker.png')
而參數是圖片的URL位址
可以在windows 上利用MobaXterm 啓動HTTP Server 並把圖片(stciker.png)放在資料匣下. . 用瀏覽器存取 http://127.0.0.1/sticker.png
sticker.png要放在C:\Users\Joseph下
但telegram Server 無法存取此網址 127.0.0.1 ? 怎麼辧呢? 我們可以利用ngrok 在電腦上打一個洞. 讓外面Telegram Server 可以連進來我們在本機(Localhost)的HTTP Sever
下載ngrok Windows版本, 並點擊執行ngrok.exe, 接著鍵入 ngrok 80 , 將會出現底下畫面
在瀏覽器上打入 http://e2412fdcd657.ngrok.io/sticker.png , 若可以存取到. 則Telgram Server 就可以存取到了,這個網址就是貼在程式碼中的圖片位址
註: 免費的MobaXterm只有180秒啓動時間就會自動關閉, 可以自己架設其他的web Server. 或註冊MobaXterm
2020年10月5日 星期一
AI邊緣運算實作: TensorFlow Lite for MCU
關於AI邊緣運算
隨著物聯網與人工智慧發展,工作負載開始由雲端移轉至終端,AI也隨之進入到嵌入式系統及物聯網終端裝置中。在終端或所謂邊緣裝置這類的超低功耗微處理器上所實現的深度學習,被稱呼為微型深度學習。然而在MCU本身運算速度就不快,記憶體空間也有限的情況下,AI模型也不能太大,因此要能確保AI 效能,同時兼顧低功耗、成本與縮短開發時間,都是研發人員所必須面對的挑戰。
2020年9月18日 星期五
好用的SSH Client : MobaXterm
在windows上用Virtual Box 建置Linux主機
下載VirtualBox 軟體: https://www.virtualbox.org/wiki/Downloads
下載 Ubuntu Image (取得一個已經包含完整系統的虛擬應用裝置檔案ova檔)
![]() |


其他
1.) Shared Folder
2.) 在windows使用SSH Client登入Ubuntu


3.) Virtualbox Guest Additions
2020年9月7日 星期一
win10安裝 Anaconda +Tensorflow2.0
conda create -n tf2.0 python=3.7
#啓用虛擬環境並安裝TF2.0 (穏定版本)
conda activate tf2.0
pip uninstall numpy
pip install numpy==1.16.2
conda install jupyter
#在虛擬環境tf2.0, 進入python 互動環境(REPL)並檢查TF版本
python
import tensorflow as tf
tf.__version__

#移除conda虛擬環境tf2.0
conda env remove --name tf2.0
pip install tf-nightly --upgrade
2020年9月3日 星期四
使用Google Compute Engine 建置Linux環境
申請Google Compute Engine 90天試用
申請時雖然會需要輸入信用卡號.但90天內使用是不用錢的 ~
1.) 建置虛擬主機
基本上其他的設定都預設就可以了, 在最下方, 按下 [建立] 就這樣清鬆地建立一台LINUX 主機了. 接下來就是遠端登入使用這台主機了.
2.) 使用SSH 登入GCE的Linux Ubuntu
使用SSH登入, 只允許使用RSA認證的方式登入。我們可以使用puttygen.exe 來產生成對的RSA public key & private key
3.) 在GCE/[中繼資料] 和 [安全殼層金鑰] 新增一組RSA Public key
2020年9月2日 星期三
Python Open GL及RL 套件安裝
執行 python3 -V 會顯示python的版本 ==> Python 3.6.9
執行 Hello PyBullet World 範例
新增一個純文字檔案, 將下列代碼複製貼上, 並存為test.py
[References]
2020年8月9日 星期日
DYNAMIXEL Motor: R+ Manager 2.0
選擇 DYNAMIXEL X 系列(因為我們是XL430-W250 servo)
Baudrate : 57600 bps (出廠預設)開始掃描, 成功掃描到 XL430-250 motor


2020年7月27日 星期一
DYNAMIXEL Motor(XL430-W250 servo) 控制
DYNAMIXEL Motor
Dynamixel智能馬達是模組化形式,採用菊鏈多串接方式。這讓用戶可以輕鬆地更改和添加馬達關節,以獲得所需的扭力和自由度。
DYNAMIXEL Motor 有的是使用TTL,有的是使用RS485的訊號來做控制
而XL430-W250 則是使用TTL訊號來做控制
控制器 <----------TTL-------------> DYNAMIXEL Motor (XL430-W250 )
UART TX -----------------------> TTL Data
UART RX <----------------------- TTL Data


PC <------UART over USB------ > U2D2 <-----TTL----> XL430-W250,
PC可使用U2D2 來控制DYNAMIXEL
關於U2D2
Ports | Description |
---|---|
4Pin UART | Convert USB and UART |
3Pin TTL Level | Connect to DYNAMIXEL with 3Pin TTL Level Communication |
4Pin RS-485 | Connect to DYNAMIXEL with 4Pin RS-485 Communication |
Status LED | Display status of Power supply, TxD(Data write) and RxD(Data Read) |
Micro-B USB | Connect to the PC with USB cable |
關於 Dynamixel XL430-W250 Servo

XL430-W250 servo 規格:
(TurtleBot3 Burger 漢堡款用之馬達)
– 位置感測器: Contactless absolute encoder (12Bit, 360°)
– 馬達: Cored Motor
– 傳輸速度: 9,600 bps – 4.5 M bps
– 控制演算法: PID 控制
– 解析度: 0.088° (=360°/4,096)
– 操作模式:
• 速度控制
• 位置控制(0-360°)
• 延伸位置控制(多圈旋轉)
• PWM 控制(電壓控制)
– 重量: 57.2g
– 尺寸(W x D x H): 28.5 x 34 x 46.5 mm
– 齒輪比: 258.5 : 1
– 靜止轉距:
• 1.0N.m(9.0V, 1.0A)
• 1.4N.m(11.1V, 1.3A)
• 1.5N.m(12.0V, 1.4A)
– 無負載速度:
• 47 rpm(9.0V)
• 57 rpm(11.1V)
• 61 rpm(12.0V)
– 操作溫度: -5 ~ +72℃
– 工作電壓: 6.5V – 12.0V (建議 11.1V)
– 待機電流: 52 mA
– 指令訊號: Digital Packet
– 通訊介面:
• Half Duplex Asynchronous Serial Communication (8bit,1stop, No Parity)
– 連結(實體層):
• TTL Level Multidrop Bus (3-pin 串接式連結)
– 可用編號: 253 ID (0-252), 可串接
– 訊號回授: 位置, 速度, 負載, 即時 Tick, 軌跡, 溫度, 輸入電壓等
– 材質: 工程塑材
– 數據如有變更,請以原廠規格為準
出廠設定:
– ID = 1– Baud Rate: 57,600bps (請依需要, 自行變更 ID 及 Baud Rate)
Control Table of EEPROM Area
Address | Size (Byte) | Data Name | Access | Default Value | Range | Unit |
---|---|---|---|---|---|---|
0 | 2 | Model Number | R | 1,060 | - | - |
2 | 4 | Model Information | R | - | - | - |
6 | 1 | Firmware Version | R | - | - | - |
7 | 1 | ID | RW | 1 | 0 ~ 253 | - |
8 | 1 | Baud Rate | RW | 1 | 0 ~ 7 | - |
9 | 1 | Return Delay Time | RW | 250 | 0 ~ 254 | 2 [μsec] |
10 | 1 | Drive Mode | RW | 0 | 0 ~ 1 | - |
11 | 1 | Operating Mode | RW | 3 | 0 ~ 16 | - |
12 | 1 | Secondary(Shadow) ID | RW | 255 | 0 ~ 252 | - |
13 | 1 | Protocol Type | RW | 2 | 1 ~ 2 | - |
20 | 4 | Homing Offset | RW | 0 | -1,044,479 ~ 1,044,479 | 1 [pulse] |
24 | 4 | Moving Threshold | RW | 10 | 0 ~ 1,023 | 0.229 [rev/min] |
31 | 1 | Temperature Limit | RW | 72 | 0 ~ 100 | 1 [°C] |
32 | 2 | Max Voltage Limit | RW | 140 | 60 ~ 140 | 0.1 [V] |
34 | 2 | Min Voltage Limit | RW | 60 | 60 ~ 140 | 0.1 [V] |
36 | 2 | PWM Limit | RW | 885 | 0 ~ 885 | 0.113 [%] |
44 | 4 | Velocity Limit | RW | 265 | 0 ~ 1,023 | 0.229 [rev/min] |
48 | 4 | Max Position Limit | RW | 4,095 | 0 ~ 4,095 | 1 [pulse] |
52 | 4 | Min Position Limit | RW | 0 | 0 ~ 4,095 | 1 [pulse] |
63 | 1 | Shutdown | RW | 52 | - | - |
Control Table of RAM Area
Address | Size (Byte) | Data Name | Access | Default Value | Range | Unit |
---|---|---|---|---|---|---|
64 | 1 | Torque Enable | RW | 0 | 0 ~ 1 | - |
65 | 1 | LED | RW | 0 | 0 ~ 1 | - |
68 | 1 | Status Return Level | RW | 2 | 0 ~ 2 | - |
69 | 1 | Registered Instruction | R | 0 | 0 ~ 1 | - |
70 | 1 | Hardware Error Status | R | 0 | - | - |
76 | 2 | Velocity I Gain | RW | 1,000 | 0 ~ 16,383 | - |
78 | 2 | Velocity P Gain | RW | 100 | 0 ~ 16,383 | - |
80 | 2 | Position D Gain | RW | 4,000 | 0 ~ 16,383 | - |
82 | 2 | Position I Gain | RW | 0 | 0 ~ 16,383 | - |
84 | 2 | Position P Gain | RW | 640 | 0 ~ 16,383 | - |
88 | 2 | Feedforward 2nd Gain | RW | 0 | 0 ~ 16,383 | - |
90 | 2 | Feedforward 1st Gain | RW | 0 | 0 ~ 16,383 | - |
98 | 1 | Bus Watchdog | RW | 0 | 1 ~ 127 | 20 [msec] |
100 | 2 | Goal PWM | RW | - | -PWM Limit(36) ~ PWM Limit(36) | - |
104 | 4 | Goal Velocity | RW | - | -Velocity Limit(44) ~ Velocity Limit(44) | 0.229 [rev/min] |
108 | 4 | Profile Acceleration | RW | 0 | 0 ~ 32,767 0 ~ 32,737 | 214.577 [rev/min2] 1 [ms] |
112 | 4 | Profile Velocity | RW | 0 | 0 ~ 32,767 | 0.229 [rev/min] |
116 | 4 | Goal Position | RW | - | Min Position Limit(52) ~ Max Position Limit(48) | 1 [pulse] |
120 | 2 | Realtime Tick | R | - | 0 ~ 32,767 | 1 [msec] |
122 | 1 | Moving | R | 0 | 0 ~ 1 | - |
123 | 1 | Moving Status | R | 0 | - | - |
124 | 2 | Present PWM | R | - | - | - |
126 | 2 | Present Load | R | - | -1,000 ~ 1,000 | 0.1 [%] |
128 | 4 | Present Velocity | R | - | - | 0.229 [rev/min] |
132 | 4 | Present Position | R | - | - | 1 [pulse] |
136 | 4 | Velocity Trajectory | R | - | - | 0.229 [rev/min] |
140 | 4 | Position Trajectory | R | - | - | 1 [pulse] |
144 | 2 | Present Input Voltage | R | - | - | 0.1 [V] |
146 | 1 | Present Temperature | R | - | - | 1 [°C] |
168 | 2 | Indirect Address 1 | RW | 224 | 64 ~ 661 | - |
170 | 2 | Indirect Address 2 | RW | 225 | 64 ~ 661 | - |
172 | 2 | Indirect Address 3 | RW | 226 | 64 ~ 661 | - |
… | … | … | … | … | - | - |
218 | 2 | Indirect Address 26 | RW | 249 | 64 ~ 661 | - |
220 | 2 | Indirect Address 27 | RW | 250 | 64 ~ 661 | - |
222 | 2 | Indirect Address 28 | RW | 251 | 64 ~ 661 | - |
224 | 1 | Indirect Data 1 | RW | 0 | 0 ~ 255 | - |
225 | 1 | Indirect Data 2 | RW | 0 | 0 ~ 255 | - |
226 | 1 | Indirect Data 3 | RW | 0 | 0 ~ 255 | - |
… | … | … | … | … | - | - |
249 | 1 | Indirect Data 26 | RW | 0 | 0 ~ 255 | - |
250 | 1 | Indirect Data 27 | RW | 0 | 0 ~ 255 | - |
251 | 1 | Indirect Data 28 | RW | 0 | 0 ~ 255 | - |
578 | 2 | Indirect Address 29 | RW | 634 | 64 ~ 661 | - |
580 | 2 | Indirect Address 30 | RW | 635 | 64 ~ 661 | - |
582 | 2 | Indirect Address 31 | RW | 636 | 64 ~ 661 | - |
… | … | … | … | … | - | - |
628 | 2 | Indirect Address 54 | RW | 659 | 64 ~ 661 | - |
630 | 2 | Indirect Address 55 | RW | 660 | 64 ~ 661 | - |
632 | 2 | Indirect Address 56 | RW | 661 | 64 ~ 661 | - |
634 | 1 | Indirect Data 29 | RW | 0 | 0 ~ 255 | - |
635 | 1 | Indirect Data 30 | RW | 0 | 0 ~ 255 | - |
636 | 1 | Indirect Data 31 | RW | 0 | 0 ~ 255 | - |
… | … | … | … | … | - | - |
659 | 1 | Indirect Data 54 | RW | 0 | 0 ~ 255 | - |
660 | 1 | Indirect Data 55 | RW | 0 | 0 ~ 255 | - |
661 | 1 | Indirect Data 56 | RW | 0 | 0 ~ 255 |
如何使用
控制協定
DYNAMIXEL SDK
DYNAMIXEL SDK supports various programming languages such as C, C++, C#, MATLAB, LabVIEW, Python and Java in order to help developing DYNAMIXEL control software. DYNAMIXEL SDK provides a bundle of functions/methods that can be used for operating DYNAMIXEL with protocols in the form of digital packet. DYNAMIXEL SDK is free to download from GitHub.step1 下載DYNAMIXEL SDK
git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git
step 2 在rapsberry pi上安裝 DYNAMIXEL library libdxl_sbc_c.so
cd ~/DynamixelSDK/c/build/linux_sbc
make
sudo make install
// This example is designed for using a Dynamixel PRO 54-200, and an USB2DYNAMIXEL.
// To use another Dynamixel model, such as X series, see their details in E-anual(emanual.robotis.com) and edit below "#define"d variables yourself.
// Be sure that Dynamixel PRO properties are already set as %% ID : 1 / Baudnum : 1 (Baudrate : 57600)