2018/10/17

mBot - Line Follower Scripts

這篇有點特殊,由於在 YoTube上有蠻多人詢問我 mBot相關問題
其中也有外國人,於是想說寫一篇中英教學文 (其實只是簡單的說明文件而已)

呃.. 先說我英文可是爛到連商教都要全猜,而且還都過不了ww
所以若有人能幫我抓錯就太感謝了


English version in bottom.




中文




這影片下面偶爾有人問到轉彎的問題,多半都是在直角彎出錯
很簡單,因為程式不斷讀取感測器,離開黑線時最後的動作被覆蓋了
於是我們可以加個變數來儲存車子當前的狀態,以便離開黑線時來調用

至於轉的順不順,就是要看經驗跟耐心了
有經驗的調一兩次就完成了,不然就是要一次一次慢慢調

兩輪速度差不能太大,會轉過頭導致車身太晃
當然也不能太小,不然會轉不過去
其實不難,但很麻煩

我的馬達線是接反的,所以有一邊的數值是負數





English




Occasionally someone in this video is asked about turning problems, most are wrong at right angles turn.
Because the program constantly read the sensors, causing the last action to be covered when leaving the black line.
So, we can add a variable to save the status, so that called when leaving the black line.

As for the fluency turn, depends on experience and patience.
Experienced can be done soon, or need to adjust slowly once and again.

The speed difference can't be too big, else mBot will turned, resulting in the mBot body too shake.
And the speed difference can't be too small, else mBot will not turn in the past.

My Motor Dupont cable is reverse, so the value of one side is negative.



本文為網誌備份

2 則留言:

  1. 有點 不懂感應器 全黑的時候 為甚麼要轉彎呢?

    回覆刪除
    回覆
    1. 那是我的馬達線是接反的應急措施ww
      截圖時忘了改掉 其實是直行

      刪除