1. 添加清华ROS源:官网
- 新建
/etc/apt/sources.list.d/ros-latest.list
,内容为:
deb https://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ bionic main
- 然后再输入如下命令,信任 ROS 的 GPG Key,并更新索引:
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
2. 更新索引
sudo apt update
3. 安装ROS
sudo apt install ros-melodic-desktop-full
4. 添加ROS环境变量
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
5. 安装完成之后初始化rosdep
sudo apt install python-rosdep
6.初始化rosdep
sudo rosdep init
rosdep update
7. 安装rosinstall
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
8.测试安装
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
- 然后将鼠标聚焦到输入最后一个命令的窗口,通过键盘的上下左右键,分别控制小王八的前进,后退,左转,右转