就如同各位從開始的夥伴們,你們一定很想快點看到,一台可以裝上雷射LiDAR導航,自主漫遊 + 路徑規劃 + 自主避障 + 影像AI   &^$%^#%%^%^&%^  ~ 等等集合了目前self-driving 前端科技的家用小車八 !! 我們記錄一位工程師,他是如何從開始的學習、蛻變到一位 self-driving developer的過程。

話說,這一開始的動作應該也是記錄摸索的過程,不過,這卻是最真實的、殘酷與慘痛代價的經驗。希望這些記錄可以減少後面跟進的學習者們寶貴的時間。

在此定義初階段的學習標的 :

  • 遠端遙控機器人 
  • LiDAR雷達建地圖
  • 自主導航與避障
  • 路徑規劃   (到這 ~ 基本該會的操作都已經具備了)

我們就從 “ROSSerial_Arduino測試 (ROS通訊點亮Arduino LED實驗)” 開始吧 ! 

1-1、Arduino IDE安裝與設定 

 

在解壓縮後的資料夾開啟終端機。輸入:
$sudo sh install.sh

安裝好後,最後會在桌面上看到Arduino的圖案。

1-2、連線架構

使用裝備 : 

  • ACER i5 筆電 win10系統
  • 樹梅派 Pi4 B (2020 年最新版)

測試架構 : 

  • 使用PC (VM)環境架設MASTER 並運行 Publisher 這兩個nodes
  • Arduino 燒錄roserial (ros_lib)的接收程式,控制LED 

筆電中的VM環境再貼一次 :

1-3. 介紹ROS Serial

參考官網 。若是你想用Arduino來做ROS的通訊模組 (也就是作為一個ROS nodes),包括publish, subscribe ROS的messages, publish TF transforms 和 get the ROS system time。 rosserial provides a ROS communication protocol that works over your Arduino’s UART.  rosserial_arduino package, you can use ROS directly with the Arduino IDE. 喔!  rosserial 這個函式庫下面有許多packages,目的就是在不同硬體系統中,可以容易地運行一個ROS node。

1-4. 安裝軟體

有兩步驟 : 先安裝自己的ROS 工作站 ,再安裝 ros_lib 在自己的Arduino IDE環境中。 

1-4-1.  安裝自己的ROS 工作站 

官網有兩種方式,一個是安裝編譯好的binaries code,另一種是從source code先編譯再安裝,我們選擇第一種(官方建議的)。

You can install rosserial for Arduino by running:

sudo apt-get install ros-melodic-rosserial-arduino
sudo apt-get install ros-melodic-rosserial

你可以把 melodic 換成你自己的ros 版本如 indigo 等

再來到 /libraries 下面檢查是否事先有ros_lib資料夾,若是有先delete掉。

  cd ~/Arduino/libraries
  rm -rf ros_lib
  rosrun rosserial_arduino make_libraries.py .

以上完成後,就可在 /ibraries 下面找到 ros_lib的資料夾

開啟Arduino IDE ,檢查以下是否存在。

arduino_ide_examples_screenshot.png

PS : 目前,另一種更簡單的作法,就是如果你不想花功夫針對你的ROS工作站去做完全安裝,你只是要可以在Arduino上跑ROS的通訊協定,你可以採用以下 : 

*Note: Currently you can install the Arduino libaries directly in the Arduino IDE. Just open the Library Manager from the IDE menu in Sketch -> Include Library -> Manage Library. Then search for “rosserial”. This is useful if you need to work on an Arduino sketch but don’t want to setup a full ROS workstation.

1-5.  測試 Arduino 的 Hello World (example publisher) 

參考官網

先燒錄Arduino程式,第一次可能會出現 ”  can’t open device “/dev/ttyS0″: Permission denied  ” ; 處理方式,

sudo usermod -a -G dialout <username>  , 其中 username 用你Linux的帳號,我自己是 zanrobot ; 完成後先logout出系統,再 login一次。此時,再燒錄Arduino時就不會有問題。

接著當以下 : 

Now, launch the roscore in a new terminal window:

roscore

Next, run the rosserial client application that forwards your Arduino messages to the rest of ROS. Make sure to use the correct serial port:

rosrun rosserial_python serial_node.py /dev/ttyUSB0

此時,又會出現 

[ERROR] [1580567065.273146]: Error opening serial: [Errno 13] could not open port /dev/ttyACM0: [Errno 13] Permission denied: ‘/dev/ttyACM0’

此時,處理一下 serial port權限的問題,

sudo chmod 666 /dev/ttyACM0

測試最後的結果,如下 : 在 VM上的node,可以收到Arduino 發佈出的文字訊息 “hello world” ! 

 

Posted in ROS

2,991 thoughts on “ROS從”零”開始 – 2. ROSSerial_Arduino測試 (Hello world, 示範publisher)

  1. An intriguing discussion is worth comment.There’s no doubt that that you should publish more about this subject matter, it may not be a taboo subject butgenerally folks don’t talk about these issues. To thenext! Kind regards!!

  2. Aw, this was a very nice post. Taking a few minutes and actual effort to produce a top notch articleÖ but what can I sayÖ I put things off a whole lot and don’t seem to get nearly anything done.

  3. Oh my goodness! Awesome article dude! Thank you so much, However I am having issues with your RSS. I don’t know why I can’t join it. Is there anyone else getting similar RSS problems? Anybody who knows the solution will you kindly respond? Thanx!!

  4. Trực Tiếp Soccer Việt Nam Vs Lebanon. Xem Truc Tiep Bong Da. Futsal Việt NamthevangtvNếu cứ nghịch như cách vừa đè bẹp Everton tới 3-1 bên trên sân khách

  5. An intriguing discussion is definitely worth comment. I think that you should write more about this subject, it might not be a taboo subject but generally people don’t discuss these issues. To the next! Best wishes!!

  6. Go to 1this website to see how to get free diamonds on cooking fever

    gh45kkm
    This game is more fun when you have as many gems as you want.If you enjoy mobile games like this you ought to check out the guide above

  7. Things i have generally told people is that when looking for a good on the net electronics retail store, there are a few elements that you have to think about. First and foremost, you need to make sure to discover a reputable as well as reliable store that has obtained great evaluations and scores from other individuals and market sector people. This will make sure that you are handling a well-known store that gives good assistance and help to their patrons. Thanks for sharing your thinking on this site.

  8. You have made some decent points there. I looked on the internet for additional information about the issue and found most
    individuals will go along with your views on this web site.

  9. Hey there would you mind letting me know
    which hosting company you’re utilizing? I’ve loaded your blog in 3 completely
    different internet browsers and I must say
    this blog loads a lot faster then most. Can you recommend
    a good hosting provider at a reasonable price? Many thanks,
    I appreciate it!

  10. Hello There. I discovered your blog the use of msn. That is a really neatly written article. I’ll be sure to bookmark it and come back to read extra of your helpful information. Thanks for the post. I will definitely return.

  11. It’s appropriate time to make some plans for the future and it’s time to be happy.

    I’ve read this post and if I could I want to suggest you few interesting things or advice.

    Maybe you could write next articles referring to this article.

    I wish to read even more things about it!

  12. Pingback: sildenafil 100mg
  13. After exploring a number of the articles on your web site, I truly
    like your technique of blogging. I book marked it to my bookmark site list and will be checking back in the near future.
    Please check out my website as well and let me know what you think.

  14. Thanks for these tips. One thing I also believe is the fact that credit cards featuring a 0 rate often entice consumers along with zero interest rate, instant authorization and easy on the net balance transfers, however beware of the top factor that is going to void that 0 easy neighborhood annual percentage rate and throw anybody out into the poor house quickly.

  15. I have been exploring for a little bit for any high quality articles or weblog posts in this kind of area .

    Exploring in Yahoo I at last stumbled upon this site.
    Studying this info So i’m satisfied to express that I’ve an incredibly good uncanny feeling I discovered just what I needed.
    I most no doubt will make certain to do not fail to remember this website and provides it
    a look on a relentless basis.

  16. I was wondering if you ever considered changing the structure of your blog?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so people could connect with it
    better. Youve got an awful lot of text for only having 1 or 2 pictures.
    Maybe you could space it out better?

  17. whoah this blog is excellent i like studying your posts.Keep up the good work! You already know, a lot of persons are searching around for this info, you could aid them greatly.

  18. I just could not go away your website prior to suggesting that I extremely loved the usual information an individual provide to your visitors?
    Is gonna be again continuously to check out new posts