1.概述
可以使用PIBOT提供鏡像,預(yù)裝了ROS
琳骡,而且已經(jīng)配置好環(huán)境,如果你想體驗(yàn)下安裝過程贞绳,也可以先輸入官方UBUNTU
后再安裝ROS
狮鸭,可以直接跳過步驟2
2.刷入pibot_ros鏡像
PIBOT網(wǎng)盤中提供了相關(guān)工具與鏡像钟鸵,我們需要使用工具Win32 Disk Mangaer及
ROS
鏡像選擇鏡像和相應(yīng)的盤符浸须,點(diǎn)擊
Write
按鈕简十,然后點(diǎn)一下Yes
確定操作硕勿,開始系統(tǒng)寫入等待安裝完成即可
刷完看到容量變小了,不用擔(dān)心汪茧,正常情況
用戶名密碼都是pibot
3 逐步安裝ROS
使用PIBOT提供的鏡像可以跳過該步驟椅亚,同時實(shí)際上面生成的鏡像就是執(zhí)行了以下步驟而已
3.1下載ubuntu
從百度網(wǎng)盤或者官網(wǎng)下載Ubuntu mate或者Lubuntu
3.2 刷入ubuntu
使用該鏡像刷入ubuntu,步驟同2刷入鏡像
3.3安裝ROS
# if [ ! -z "$PIBOT_HOME" ]; then
# PIBOT_HOME_DIR=$PIBOT_HOME
# else
# PIBOT_HOME_DIR=~/pibot_ros
# fi
echo -e "\033[1;32mpibot home dir:$PIBOT_HOME_DIR"
# http://wiki.ros.org/ROS/Installation/UbuntuMirrors
sudo sh -c 'echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
code_name=$(lsb_release -sc)
if [ "$code_name" = "trusty" ]; then
ros_version="indigo"
elif [ "$code_name" = "xenial" ]; then
ros_version="kinetic"
elif [ "$code_name" = "bionic" ] || [ "$code_name" = "stretch" ]; then
ros_version="melodic"
else
echo "PIBOT not support "$code_name
exit
fi
echo "ros:" $ros_version
if [ "$ros_version" = "melodic" ]; then
# third
# cd $PIBOT_HOME_DIR/third_party
# cd libuvc
# mkdir -p build
# cd build && cmake .. && sudo make install
# cd $PIBOT_HOME_DIR
# if [ ! -d $PWD/ros_package ]; then
# mkdir ros_package
# fi
# cd ros_package
# # astra ros package
# if [ -f $PWD/astra.tar.gz ]; then
# tar xzvf $PWD/astra.tar.gz
# else
# git clone https://github.com/orbbec/ros_astra_launch.git
# git clone https://github.com/orbbec/ros_astra_camera.git
# fi
# frontier_exploration ros package
# if [ -f $PWD/frontier_exploration.tar.gz ]; then
# tar xzvf $PWD/frontier_exploration.tar.gz
# else
# git clone -b melodic-devel https://github.com/paulbovbel/frontier_exploration.git
# fi
# cd ..
# echo "ln -sf $PWD/ros_package ros_ws/src/ros_package"
# if [ -f ros_ws/src/ros_package ]; then
# rm ros_ws/src/ros_package
# fi
# ln -snf $PWD/ros_package ros_ws/src/ros_package
sudo apt-get -y --allow-unauthenticated install ros-${ros_version}-ros-base ros-${ros_version}-slam-gmapping ros-${ros_version}-navigation \
ros-${ros_version}-xacro ros-${ros_version}-yocs-velocity-smoother ros-${ros_version}-robot-state-publisher \
ros-${ros_version}-joint-state-publisher ros-${ros_version}-teleop-twist-* ros-${ros_version}-control-msgs \
ros-${ros_version}-kdl-parser-py ros-${ros_version}-tf2-geometry-msgs ros-${ros_version}-hector-mapping \
ros-${ros_version}-robot-pose-ekf ros-${ros_version}-slam-karto ros-${ros_version}-hector-geotiff ros-${ros_version}-hector-trajectory-server \
ros-${ros_version}-usb-cam ros-${ros_version}-image-transport ros-${ros_version}-image-transport-plugins \
ros-${ros_version}-depthimage-to-laserscan ros-${ros_version}-openni2* ros-${ros_version}-freenect-* \
ros-${ros_version}-robot-upstart ros-${ros_version}-tf-conversions ros-${ros_version}-orocos-kdl \
ros-${ros_version}-realsense2-camera ros-${ros_version}-camera-umd ros-${ros_version}-libuvc* \
ros-${ros_version}-camera-calibration ros-${ros_version}-rtabmap* ros-${ros_version}-cartographer-ros \
ros-${ros_version}-web-video-server ros-${ros_version}-roslint
else
sudo apt-get -y --allow-unauthenticated install ros-${ros_version}-ros-base ros-${ros_version}-slam-gmapping ros-${ros_version}-navigation \
ros-${ros_version}-xacro ros-${ros_version}-yocs-velocity-smoother ros-${ros_version}-robot-state-publisher \
ros-${ros_version}-joint-state-publisher ros-${ros_version}-teleop-twist-* ros-${ros_version}-control-msgs \
ros-${ros_version}-kdl-parser-py ros-${ros_version}-tf2-geometry-msgs ros-${ros_version}-hector-mapping \
ros-${ros_version}-robot-pose-ekf ros-${ros_version}-slam-karto ros-${ros_version}-hector-geotiff ros-${ros_version}-hector-trajectory-server \
ros-${ros_version}-usb-cam ros-${ros_version}-image-transport ros-${ros_version}-image-transport-plugins \
ros-${ros_version}-astra-launch ros-${ros_version}-astra-camera ros-${ros_version}-depthimage-to-laserscan \
ros-${ros_version}-openni2* ros-${ros_version}-freenect-* ros-${ros_version}-tf-conversions \
ros-${ros_version}-robot-upstart ros-${ros_version}-frontier-exploration ros-${ros_version}-orocos-kdl \
ros-${ros_version}-realsense2-camera ros-${ros_version}-camera-umd ros-${ros_version}-libuvc* \
ros-${ros_version}-camera-calibration ros-${ros_version}-rtabmap* ros-${ros_version}-cartographer-ros \
ros-${ros_version}-web-video-server
fi
read -s -n1 -p "install ros gui tools?(y/N)"
if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
sudo apt-get -y --allow-unauthenticated install ros-${ros_version}-rviz ros-${ros_version}-rqt-reconfigure ros-${ros_version}-rqt-tf-tree \
ros-${ros_version}-image-view ros-${ros_version}-cartographer-rviz
fi
復(fù)制上面腳本保存至文件install_ros.sh
,執(zhí)行sh install_ros.sh
4.測試
安裝完成舱污,運(yùn)行roscore可以看到下面輸出即可標(biāo)識完成ros安裝
source /opt/ros/melodic/setup.bash
# ubuntu16
# source /opt/ros/kinetic/setup.bash
roscore
5.交換分區(qū)的設(shè)置
5.1 查看交換分區(qū)
free -m
** 如果顯示下圖呀舔,標(biāo)識已經(jīng)有2G的交換空間,無需再次設(shè)置**
5.2 創(chuàng)建交換分區(qū)
5.2.1 創(chuàng)建交換分區(qū)
sudo mkdir /opt/image
cd /opt/image/
sudo touch swap
sudo dd if=/dev/zero of=/opt/image/swap bs=1024 count=2048000
sudo mkswap /opt/image/swap
sudo swapon /opt/image/swap
dd
命令執(zhí)行時間較長
再次查看交換分區(qū)
free -m
5.2.2 設(shè)置重啟生效
sudo vim /etc/fstab
最后行添加
/opt/image/swap /swap swap defaults 0 0
重啟后再次查看
free -m