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

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

0-1、如何接近ROS ? 

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

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

我們就從 “ROS遠端遙控機器人” 開始吧 !

0-2、遠端遙控之系統架構

使用裝備 :

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

測試架構 :

筆電端 : 經過資料蒐集與無數次的誤打誤撞後,決定灌 VM 走 ROS Melodic Morenia。參考以下

官網資訊說明 Melodic 是最新持續update。

根據官網說法,

ROS Melodic installation instructions

These instructions will install the ROS Melodic Morenia distribution, which is available for Ubuntu Artful (17.10), Bionic (18.04 LTS) and Debian Stretch, among other platform options.

0-3、win10 筆電安裝VM (虛擬機)進行ubuntu環境安裝

我們決定先用PC安裝VM環境,如下 :

到Ubuntu官網下載 18.04LTS 印像檔 (ubuntu-18.04.3-desktop-amd64.iso ) , 約2.3G 下載時間約需 40分。

到VM中,點選 “Create a New Virtual Machine” ,一個按鍵可以安裝完成Ubuntu 18.04系統。不過系統安裝時間也約需40分鐘。

0-4、安裝 ROS Melodic Morenia 

請到ROS官網,按照步驟操作 :

1. Configure your Ubuntu repositories

按照下面的選項, “source code” 要勾一下,下載地點可依據下拉選單,選擇 “Select Best Server”,系統會自動去測試哪個server下載比較快。

Software Sources.png

選完下載伺服器後,點 “close”,接著會問是否要更新清單,選 “Reload” 來更新倉庫清單。

Select “Close” to save your changes. A dialog box should appear, asking whether you’d like to update the list of repositories. Select “Reload” to update the list.

Repobuttons.png

接著在 Alt+Ctrl照做以下動作。 refer to : http://wiki.ros.org/melodic/Installation/Ubuntu

Setup your sources.list

Setup your computer to accept software from packages.ros.org.

  • sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Mirrors

Source Debs are also available

Set up your keys

  • sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

If you experience issues connecting to the keyserver, you can try substituting hkp://pgp.mit.edu:80 or hkp://keyserver.ubuntu.com:80 in the previous command.

Alternatively, you can use curl instead of the apt-key command, which can be helpful if you are behind a proxy server:

  • curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -

Installation

First, make sure your Debian package index is up-to-date:

  • sudo apt update

There are many different libraries and tools in ROS. We provided four default configurations to get you started. You can also install ROS packages individually.

In case of problems with the next step, you can use following repositories instead of the ones mentioned above ros-shadow-fixed

    • Desktop-Full Install: (Recommended) : ROS, rqtrviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception

      • sudo apt install ros-melodic-desktop-full

        or click here

      Desktop Install: ROS, rqtrviz, and robot-generic libraries (~ 我們這裡用這個 ~ 耗時30分) 

      • sudo apt install ros-melodic-desktop

        or click here

      ROS-Base: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.

      • sudo apt install ros-melodic-ros-base

        or click here

      Individual Package: You can also install a specific ROS package (replace underscores with dashes of the package name):

    • sudo apt install ros-melodic-PACKAGE

      e.g.

      sudo apt install ros-melodic-slam-gmapping

To find available packages, use:

apt search ros-melodic

Environment setup

It’s convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

To install this tool and other dependencies for building ROS packages, run:

sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

Initialize rosdep

Before you can use many ROS tools, you will need to initialize rosdeprosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS. If you have not yet installed rosdep, do so as follows.

sudo apt install python-rosdep

With the following, you can initialize rosdep.

sudo rosdep init
rosdep update

到此為止,ROS算是安裝完成了。

可以試試看以下 roscore 命令,得到正確的回應。

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>