如何使用 Virtual Robot (2D Smiulator)?

開啟 AlphAI Software 後 , 除了會出現連接 AlphAI (編號)外還會出現「2D Simulator」,

2D Simulator 的作用是能在沒實體 AlphAI 的情況上使用 AlphAI Software ,

大部份情況下 AlphAI 都是一機多人分組使用的 ,  其中不少 TASK / Training 是能先在 2D Simulator 先進行訓練的 ,

同學們可先利用 「2D Simulator」先進行學習再接駁至實體機測試成果。

當中 2D Simulator 的內容可分為 :

1. 能在 Simulator 上做到 並能無縫轉移至實體 AlphAI 上 , 例如 : line following (IR Sensor) , 避障 ( distance)

2. 能在 Simulator 上做到 , 但不能將模擬的學習內容轉移至實體 AlphAI 上 , 例如 : KNN , Robot Race ( pixel value)

3. 不能在 Simulator 上模擬 , 例如 : 人臉/物件識別 (需使用鏡頭)

如何操縱 Virtual Robot ?

使用 2D Simulator 會出現一個長方形的紅框模擬 Racing Circuit , 以及一個圓形的 Virtual Robot (AlphAI)

將 Mouse 移動至 Virtual Robot 上 :

  • 按住左 click 可以移動它到任何位置
  • 按住右 click 可以改變它的方向  

示例 (黑線追蹤) :

學習目標 :

利用 2D Simulator 進行訓練 , 並將訓練成果 ( training model ) 套用在真實的 AlphAI上。

所需準備 :

材料 : Demo Configuration : Supervised Learning - Line Tracking
一些黑膠帶和剪刀 Sensor (Input)傳感器 IR sensor; detect black;5 sensors紅外線傳感器;檢測黑色;5個傳感器
Action (Output)行動 動作標籤
  • Forward,  Turns (Left and Right)
  • 向前移動,輕微轉彎(向左和向右)
  • “Duration” sets to 0.1 seconds to ensure fast refresh of data and calculation.
  • 持續時間設置為0.1秒,以確保數據和計算的快速刷新。
  • speed = 20
  • 建議將 backward 及 Slight Turn 刪除
AI Supervised Learning, Neural Network監督學習,神經網絡
Visualization可視化 Main Display : <Training Data>

你應會得到以上的 Setup。

透過移動 Virtual Robot 的位置可改變 IR Sensor 的數值 ,

中間的 IR Sensor 呈深黃色代表 Virtual Robot 在黑線的中心行駛 ,

從IR數值及模擬場景推斷 Virtual Robot 都應繼續向前行 ==> 因此 action = 向前行

  • 當中間的IR Sensor 在黑線上+ 數值 > 0.7  --> 直行
  • 當左面的 IR Sensor在黑線上 + 數值 > 0.7 --> 向左修正方向
  • 當 面的 IR Sensor在黑線上 + 數值 > 0.7 --> 向右修正方向

訓練 :

完成訓練後 Virtual Robot 應該能循線行駛

將 2D Simulator 的 Training Data 套用在真實的 AlphAI 上 :

方法一 - 直接斷開連接 :

1. 按下右下角的「Disconnect」

2. 連接至真實的 AlphAI

注意 : 斷開連接的時間不能太長

顯示的 Output 會跟訓練 Virtual Robot 時一樣並能成功做到循線效果

方法二 - 先儲存 Training data , 連接 AlphAI 後再導入 :

會儲存成 zip file

導入 Training data :

直接將整個 zip file 打開就能使用