官方教程:http://turtlebot3.robotis.com/en/latest/pc_software.html
這篇博客是在[Remote PC](以下統稱PC)上操作的,也就是你的筆記本電腦或者臺式機,不要在TurtleBot3上面操作。操作的環境是ubuntu 16.04.
1. 在PC上安裝Ubuntu
下載ubuntu 16.04到PC上
- 如果你需要一步一步的安裝教程的話,請看下面這個教程:
- 2.在PC上安裝ROS
- 進入到這一步意味着你已經安裝好ubuntu系統了,這裏有兩種方式在ubuntu上安裝ROS
- ,如果你喜歡手動操作的話請按照第二種操作方式。
- 2.1.1 第一種方式
- 使用一個簡單的腳本文件來安裝ROS,ubuntu的終端的快捷鍵是Ctrl+Alt+T,在窗口中逐
- 句輸入以下命令:
sudo apt-get update sudo apt-get upgrade wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_kinetic.sh && chmod 755 ./install_ros_kinetic.sh && bash ./install_ros_kinetic.sh
2.1.2 第二種方式
你可以從下面的連接中的“1.2 Setup yours sources.list”一直看到“1.7 Getting ros install”:
爲了確認哪些包被安裝了,請查看下面這個鏈接:
2.1.3 配置ROS環境
如果你打算在PC上修改或者開發源代碼,你就需要配置ROS環境。下面是一個簡單的教程,可能需要花幾分鐘:
接下來是爲了TurtleBot3的控制安裝依賴包:
sudo apt-get install ros-kinetic-joy ros-kinetic-teleop-twist-joy ros-kinetic-teleop-twist-keyboard ros-kinetic-laser-proc ros-kinetic-rgbd-launch ros-kinetic-depthimage-to-laserscan ros-kinetic-rosserial-arduino ros-kinetic-rosserial-python ros-kinetic-rosserial-server ros-kinetic-rosserial-client ros-kinetic-rosserial-msgs ros-kinetic-amcl ros-kinetic-map-server ros-kinetic-move-base ros-kinetic-urdf ros-kinetic-xacro ros-kinetic-compressed-image-transport ros-kinetic-rqt-image-view ros-kinetic-gmapping ros-kinetic-navigation
(上面這句得等一會)
cd ~/catkin_ws/src/
git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3.git
cd ~/catkin_ws && catkin_make
(這裏可能會出現catkin_make命令不存在的錯誤,解決方案:重啓,因爲前面裝完ROS需要重啓。)如果在上面的過程中沒有出現任何錯誤,TurtleBot3的準備工作就做好了。)
2.3 無線網配置
爲了TurtleBot3和PC之間的連接,ROS需要IP地址。
在PC的ubuntu的終端裏面輸入下面這條命令查看PC的ip地址:
ifconfig
下圖中的紅色矩形框的內容就是PC的ip地址(就是wlp2s0中的inet addr):
然後輸入下面這條命令:
gedit ~/.bashrc
修改ROS_MASTER_URI的地址爲上面獲取到的ip
這裏上圖獲取到的ip是192.168.0.206,那麼下面的兩句話就是
export ROS_MASTER_URI=http://192.168.0.206:11311
export ROS_HOSTNAME=192.168.0.206
然後是右上角save,左上角叉掉。
如下圖所示:
最後用下面這句命令使之生效:
source ~/.bashrc