在Ubuntu18.04下安装Ros-melodic
参考连接:官网连接
ROS包:https://github.com/IntelRealSense/realsense-ros
Ros-melodic安装: http://wiki.ros.org/melodic/Installation/Ubuntu
1.1配置Ubuntu存储库
1.2设置sources.list
sudo sh -c'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc)main"> /etc/apt/sources.list.d/ros-latest.list'
1.3 set up your keys:添加密钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
1.4 Installation更新
sudo apt update
1.5 桌面完整安装
a: Desktop-Full Install: (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception:
sudo apt install ros-melodic-desktop-full
若此时运行出错: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).
sudo apt --fix-broken install
b: Desktop Install: ROS, rqt, rviz, and robot-generic libraries
sudo apt install ros-melodic-desktop
c: ROS-Base: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
sudo apt install ros-melodic-ros-base
d: Individual Package: You can also install a specific ROS package (replace underscores with dashes of the package name):
sudo apt install ros-melodic-PACKAGE
e.g.
sudo apt install ros-melodic-slam-gmapping
1.6 Environment setup:环境变量
a: If you have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version you are currently using.
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
b: If you just want to change the environment of your current shell, instead of the above you can type:
source /opt/ros/melodic/setup.bash
c: If you use zsh instead of bash you need to run the following commands to set up your shell:
echo "source /opt/ros/melodic/setup.zsh" >> ~/.zshrc
source ~/.zshrc
1.7 Dependencies for building packages:
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
1.8 Initialize rosdep:
sudo apt install python-rosdep
sudo rosdep init
rosdep update
运行出错sudo rosdep init
解决:
#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133 raw.githubusercontent.com
解决:
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
rosdep update出错:
https://blog.csdn.net/Kenny_GuanHua/article/details/116845781
1.9 测试
在终端运行
roscore