從去年7月份左右開始接觸ROS,一直都想整理一些東西出來和大家分享以下.可惜一直沒執行下去.靜不下心來整理,而且說實話,本人學的
也不怎麼樣.權作學習筆記.
其實很多都是直接從網站上面照着抄下來的.ROS網站上面資料非常齊全,
ROS 安裝:
ROS安裝其實很簡單.按照如下網站中的步驟,一步一步執行即可.如果你想從源碼編譯安裝,可參考參考網站2(不推薦)
參考網站1:
http://wiki.ros.org/indigo/Installation/Ubuntu
參考網站1:
http://wiki.ros.org/indigo/Installation/Source
Environment setup:
1. It's convenientif the ROS environment variables are automatically added to your bashsession every time a new shell is launched:
$ echo "source/opt/ros/indigo/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
2. If you just wantto change the environment of your current shell, you can type:
$ source/opt/ros/indigo/setup.bash
Cteate a ROS Workspace
1. Creating a new workspace
The following command creates a new workspace in ~/workspace/ROS which extends the set of packages install in /opt/ros/indigo
$ rosws init ~/workspace/ROS /opt/ros/indigo
$ source ~/workspace/ROS/setup.bash
(該方式配置,每次打開終端均需配置該環境.如果想每次自動加載,參考環境配置的方式)
rosws命令是rosinstall package中命令.如果沒有安裝,輸入下訴命令安裝
$ sudo apt-get install python-rosinstall
2. Creating a sandbox directory for new packages.
New packages need to be put in a path that is in the variable ROS_PACKAGE_PATH.All directories that are managed by rows, i.e. that have been added using rosws are automatically added to the ROS_PACKAGE_PATH when the file setup.bash of the corresponding workspace is sourced.
$ mkdir ~/workspace/ROS/theFirstPackage
$ rosws set ~/workspace/ROS/theFirstPackage
3. Confirmation
To confirm that your package path has been set, echo the ROS_PACKAGE_PATH variable.
$ echo $ROS_PACKAGE_PATH
You should see something similar to:
/home/burial/workspace/ROS/camera:/opt/ros/indigo/share:/opt/ros/indigo/stacks
小試牛刀:
安裝ROS成功後,在Beginner Tutorials中有一個簡單的示例程序.
1. 在Terminal中輸入下訴命令.我的理解是,該命令是初始化ROS環境,全局參數,以及每個節點註冊等工作.
$ roscore
$ rosrun turtlesim turtlesim_node
$ rosrun turtlesim turtle_teleop_key
4. 選中最後打開的Terminal,鍵盤按下上下左右按鍵,可看到控制小烏龜移動.
5. 再打開一個Terminal,輸入下訴命令,可以看到當前ROS nodes以及Topic等圖形展示.
$ rosrun rqt_graph rqt_graph
由上圖可見,左右兩邊矩形爲ROS node,中間連線上是Topic名稱.