古人智慧

Just Do it!
上士聞道,勤而行之;中士聞道,若存若亡;下士聞道,大笑之。不笑,不足以爲道。
~ 道德經 41

「實現夢想不是追逐成功,而是在於賦予生命意義,人生中的每個決定與聲音都有其重要含義。」"The key to realizing a dream is to focus not on success but on significance — and then even the small steps and little victories along your path will take on greater meaning."
電視名人-歐普拉·溫芙蕾(OPRAH WINFREY)

搜尋此網誌

Translation

2015年9月3日 星期四

蜘蛛Robot - Quadruped Robot - 《遥控器制作 Remoter 》

用手機或PC/Mac遙控蜘蛛Robot實在沒什麼感覺,想想應該來做個遙控器吧。。。
翻翻零件庫,哇!有兩個Joystick,太開心了。。。。
一般我的做法是先用麵包板做實驗,把電路模擬一次,確定無誤後再施工會比較不浪費時間。





想洗PCB,但是DIY的材料與工具還在海峽對岸,所以繼續用洞洞板來施工。





把這些零件試擺一下,用油性筆把大小畫出來,然後用美工刀在洞洞板的正面背面畫上幾刀,就可以折下來。



然後,就一條條開始“努力”的用烙鐵來焊接。
老花越來越嚴重,戴眼鏡+放大鏡都還很吃力的說。。。
花了兩個小時,出爐了,開心!!!

《正面》

《背面》


《側面》

遙控器的藍芽材料還沒到手,只好先透過Macbook的BT與蜘蛛robot連接。
材料到手後再想想如何加上電池與BT。

遙控器的code寫好後,上傳到arduino
看來效果還不錯,準備與蜘蛛robot做第一次接觸。





心得:
以為搖杆的software應該很簡單,實驗的結果按鍵的debounce處理最麻煩。
如果沒有好好處理debounce的部份,按鍵很容易產生誤動作。
經過多次試驗,用timer+interrupt是最佳的解決方案。

我用timer2的ISR(Interrupt Service Routine)來偵測這兩顆按鍵,每10ms做一次,如果在100ms持續按著,那就認為按鍵確立。

X/Y軸的控制也很麻煩,參考同好的做法

dir = atan2(Y/X)
speed = sqrt(pow(X, 2) + pow(Y, 2))

這樣就可以用搖杆控制方向與速度,軟體開發真的是複雜。。。



2015-09-05
遙控器結構設計


硬件與軟件完成了,接下來就是設計結構。

照慣例,用Sketchup做3D建模



當印出來後發現忘了在主板下面加個支撐,不過,尺寸還抓的很準。


上次印蜘蛛的結構發現噴頭有堵塞的情況,這次我已經把噴頭清潔過了,印得很好。




組合後好看!!而且可以把這兩個搖杆好好固定住,好用,3D打印機真是好夥伴!

2015-09-06
Python simulation

Python的code改為接收遙控器的UART port,然後計算搖杆的角度與強度,就可以控制蜘蛛robot的方向與速度。
我先用右邊的搖杆做實驗,視頻分享:


可以看出,搖杆移動越大,速度越快。。。。

porting到蜘蛛robot就是這樣的效果,可以用搖杆控制方向與速度,好玩!!!


《另一個拍的比較穩定的視頻》


然後,IR避障器也有作用,手一靠近,蜘蛛robot就向後躲,
閃幾次後不爽,還往前衝!!!
真好玩!!!







22 則留言:

  1. 好順暢的動作,真厲害。
    可以在腳的下端套上一段橡膠管,這有有止滑效果與少許避震,移動起來會更順暢。

    回覆刪除
  2. Hı regıshsu.
    Can you give shematıcs and codes?
    rusenyyc@gmail.com

    回覆刪除
  3. 作者已經移除這則留言。

    回覆刪除
  4. Hallo regis,
    it is awesome, is there any possibility you could give me the code?
    Thanks a lot.
    Lillianguan49@gmial.com

    回覆刪除
  5. 可以跟您要搖控器的arduino code嗎?這太酷了!但我寫不出來!感謝
    julshow423@gmail.com

    回覆刪除
    回覆
    1. Friend can you give me that code because lmaked a spider robot.but I have not code for remote. Can you give me that code.my gmail nhdarckshadow2001 @gmail.com

      刪除
    2. Friend can you give me that code because lmaked a spider robot.but I have not code for remote. Can you give me that code.my gmail nhdarckshadow2001 @gmail.com

      刪除
  6. Hi Regis

    My spider is walking! Thanks for sharing the design, it is a fun project. I too would like to ask if you could share the code for the Bluetooth remote transmitter? My email is ArtSuzhou@gmail.com. Thanks.

    回覆刪除
    回覆
    1. I would suggest using mobile phone or tablet. please refer to my another project https://www.instructables.com/id/DIY-Spider-Robot-PART-II-Remote-control/

      刪除
  7. Hi, could you pass the codes and how to run the simulator?
    jorge.david.zepmed@gmail.com

    回覆刪除
  8. Please sir send the remote control all parts in English

    回覆刪除
    回覆
    1. Did he sent you the code?

      刪除
    2. Please sir send the remote control code .thanks
      my mail: gassen.taaam@gmail.com

      刪除
  9. I was able to make it work using the sample dance. I am trying to use a remote made on Blynk but have not been successful. Can I get the code please? amidamarhu@hotmail.com

    回覆刪除
  10. Hallo regis,
    it is awesome, is there any possibility you could give me the code?
    Thanks
    techtaam@gmail.com

    回覆刪除
  11. could you give me the raspberry pi code?

    回覆刪除
  12. This thing is amazing!
    Can you send me Arduino Code please?
    My email is: danielojestem@gmail.com

    回覆刪除
  13. Of Can you give shematıcs and Codes?
    morad.camera@gmail.com

    回覆刪除
  14. Regis,實在搞不懂方向怎樣設置,原來都是串口文本命令,要麼左,要麼右。現在是搖杆,左右上下都會有向量。能不能把原代碼這部份發給我學習一下,謝謝!郵箱:stephen.qlf@gmail.com

    回覆刪除
  15. Is it possible to find somewhere source code for remote control for spider? I can't program it myself. Yours faithfully, Jaroslav
    modelkit@atknet.sk

    回覆刪除
  16. Can you give shematıcs and Codes? scottwiley3@gmail.com Great Job!

    回覆刪除
  17. Great Job! I am actually building it right now and it´s a lot of fun though I must say it is pushing my amateur limits concerning both 3D-printing and code.

    回覆刪除