ubuntu 18.04 ros 安装
1.reference official website
安装命令
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ `lsb_release -cs` 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
sudo apt install ros-melodic-desktop-full
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update
2. some problem and solution method |
sudo rosdep init
error prompt : 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.
resolve method :
sudo mkdir -p /etc/ros/rosdep/sources.list.d
sudo gedit /etc/hosts
在/etc/hosts文件尾端添加: 151.101.76.133 raw.githubusercontent.com
成功提示如下:
prompt: Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please runrosdep update
可以查看一下:
cat /etc/ros/rosdep/sources.list.d/20-default.list
参考:(添加一下服务器ip)
https://blog.csdn.net/weixin_43958086/article/details/108658396
rosdep update
如果不能更新,检测一下网絡,更改一下软件源,多试几次 |
https://blog.csdn.net/qq_39397000/article/details/83753968
设置环境变量
@ubuntu:~$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
@ubuntu:~$ source ~/.bashrc
打开三个命令窗口依次运行以下命令
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
用方向盘就可以控制小海龟运动了