Ros Install (noetic)

Ros Install (noetic)

當初老師請我在大教室的電腦上面灌 ROS,因為我當初沒有使用 Ansible 之類的軟體,所以就寫了個 script,每台開起來 clone 下來跑,這是當初的紀錄,也許可以幫到某位有緣人(?

github

1
git clone https://github.com/NcuMathRoboticsLab/MRLRosInstall.git

手動操作

沒有 vim 的話看你要裝還是用 nano

1
vim install.sh

把下面的內容貼上:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

sudo apt update
sudo apt upgrade
wget https://raw.githubusercontent.com/ROBOTIS-GIT/robotis_tools/master/install_ros_noetic.sh
chmod 755 ./install_ros_noetic.sh
bash ./install_ros_noetic.sh

sudo apt-get install ros-noetic-joy ros-noetic-teleop-twist-joy \
ros-noetic-teleop-twist-keyboard ros-noetic-laser-proc \
ros-noetic-rgbd-launch ros-noetic-rosserial-arduino \
ros-noetic-rosserial-python ros-noetic-rosserial-client \
ros-noetic-rosserial-msgs ros-noetic-amcl ros-noetic-map-server \
ros-noetic-move-base ros-noetic-urdf ros-noetic-xacro \
ros-noetic-compressed-image-transport ros-noetic-rqt* ros-noetic-rviz \
ros-noetic-gmapping ros-noetic-navigation ros-noetic-interactive-markers

sudo apt install ros-noetic-dynamixel-sdk
sudo apt install ros-noetic-turtlebot3-msgs
sudo apt install ros-noetic-turtlebot3

sudo echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
sudo echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
sudo echo "export ROS_MASTER_URI=http://localhost:11311" >> ~/.bashrc
sudo echo "export ROS_HOSTNAME=localhost" >> ~/.bashrc
sudo echo "export TURTLEBOT3_MODEL=burger" >> ~/.bashrc

source ~/.bashrc

cd ~
mkdir catkin_ws
mkdir catkin_ws/src
cd ~/catkin_ws/src

git clone -b noetic-devel https://github.com/ROBOTIS-GIT/DynamixelSDK.git
git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3.git
git clone -b noetic-devel https://github.com/ROBOTIS-GIT/turtlebot3_simulations.git

cd ~/catkin_ws && catkin_make
source ~/.bashrc

貼上後下:

1
2
chmod +x install.sh
./install.sh

過程中會有需要輸入 Y 與 enter 的地方

測試

Turtlebot simulator

1
2
export TURTLEBOT3_MODEL=waffle
roslaunch turtlebot3_gazebo turtlebot3_world.launch

SLAM

1
2
3
4
roslaunch turtlebot3_gazebo turtlebot3_world.launch
roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
rosrun map_server map_saver -f ~/map

上面那個要先做完這個才能跑

1
2
roslaunch turtlebot3_gazebo turtlebot3_world.launch
roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=$HOME/map.yaml