melodic
版)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 update
检查cmake
的版本,尽量升级到最新版本:https://blog.csdn.net/RNG_uzi_/article/details/107016899
这里介绍桌面完整版(推荐): 包含 ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及 2D/3D 感知包, 其他参考官方网站。
sudo apt install ros-melodic-desktop-full
sudo rosdep init
rosdep update
备注:上述两条命名可能报错:
sudo rosdep init错误
ERROR:cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down
解决办法1
打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133 raw.githubusercontent.com
#保存后退出再尝试
备注:raw.githubusercontent.com
的其他IP访问地址,可以通过http://tool.chinaz.com/dns网站查询,选择ping最小值那个IP地址。
解决办法2
sudo c_rehash /etc/ssl/certs
sudo -E rosdep init
rosdep update
如果还是提示错误,请将源更更换为清华源,然后sudo apt update
(请将网络换成手机热点)
rosdep update出错
reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
ERROR: error loading sources list:
The read operation timed out
运行:(网络换成手机热点,如果是time out,那就多尝试几次)
sudo apt-get update
sudo apt-get install python-rosdep
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
使用下面命令安装ROS插件(包括3D包围框)
sudo apt install ros-melodic-jsk-rviz-plugins
打开终端,输入roscore命令,可以看到ROS已经成功在ubuntu上运行起来。
sudo apt-get remove ros-melodic-*
ROS安装主要参考:https://www.guyuehome.com/10082
其他可能遇到的问题及其解决方案:
18.04 安装ros 出现 ERROR: cannot download default sources list from: https://raw.githubusercontent.com/......:https://blog.csdn.net/qq_35822136/article/details/106320587
Ubuntu18.04 ROS填坑之 roscore Command ‘roscore‘ not found: https://blog.csdn.net/jdx130/article/details/107647324
Resource not found: rgbd_launch 解决方案:https://blog.csdn.net/Hacker_MAI/article/details/108009916
安装方法参照官网:https://github.com/IntelRealSense/realsense-ros 中方法1(使用apt-get直接安装)
#18.04 直接安装
$export ROS_VER=melodic
#16.04
$export ROS_VER=kinetic
安装realsense2-camera
$sudo apt-get install ros-$ROS_VER-realsense2-camera
(This will install both realsense2_camera and its dependents, including librealsense2 library.)
sudo apt-get install ros-$ROS_VER-realsense2-description
https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md#installing-the-packages
$mkdir -p ~/catkin_ws/src
$cd ~/catkin_ws/src/
$git clone https://github.com/IntelRealSense/realsense-ros.git
$cd realsense-ros/ git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
$cd ..
$catkin_init_workspace
$cd ..
$catkin_make clean
$catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
$catkin_make install