ROS melodic安装

2020-01-28  本文已影响0人  wuyifan1995

官方guide

  1. 修改软件源
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
  1. 设定key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  1. 安装完整ROS
sudo apt update
sudo apt install ros-melodic-desktop-full
  1. 初始化rosdep
sudo rosdep init
rosdep update

如果报错,参考知乎

  1. 添加环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
  1. 安装building所需要的包
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
  1. 测试
roscore
rosrun turtlesim turtlesim_node
  1. 创建第一个workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace

devel文件中有setup.bash 来添加路径,当打开一个新的shell的时候就需要,如果没有这条代码,那么就没有办法找到。如果只有一个workspace 那么就在.bashrc 中添加 “”,这样就会自动设置。

# 自动
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc 
source ~/.bashrc
  1. 创建第一个包
# 在构建的workspace的src里面
cd ~/catkin_ws/src
catkin_create_pkg <package_name> [depend1] [depend2] [depend3]
cd ..
catkin_make
# example:std_msgs全称standard_message,即标准消息.如果你的message是一些比较常见的量比如float, int, bool, array等
$ catkin_create_pkg first_pkg std_msgs rospy roscpp 
上一篇下一篇

猜你喜欢

热点阅读