安装
http://wiki.ros.org/cn/ROS/Installation
http://wiki.ros.org/cn/kinetic/Installation/Ubuntu
https://github.com/ROBOTIS-GIT/robotis_tools/blob/master/install_ros_melodic.sh
1 配置 Ubuntu 软件仓库
配置你的 Ubuntu 软件仓库(repositories) 以允许 "restricted"、"universe" 和 "multiverse"这三种安装模式。 image.png image.png2 添加 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'
3 添加公钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
4 安装
首先,确保你的 Debian 包索引是最新的:
sudo apt update
桌面完整版
sudo apt install ros-melodic-desktop-full
整个安装脚本
## install ROS
echo "199.232.68.133 raw.githubusercontent.com" >> /etc/hosts
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.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-get update
sudo apt install ros-melodic-desktop-full
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo rosdep init
rosdep update
如出现Unable to locate package ros-kinetic-desktop-full 参考
ros的版本更新了,
apt-cache search ros
查看存在的版本号对应着版本安装
image.png
则安装
#noetic 为ros的 版本
sudo apt install ros-noetic-desktop-full
~/.bashrc 的配置
# Set ROS Kinetic
source /opt/ros/melodic/setup.bash
source ~/catkin_ws/devel/setup.bash
# Set ROS Network
export ROS_HOSTNAME=xxx.xxx.xxx.xxx
export ROS_MASTER_URI=http://${ROS_HOSTNAME}:11311
# Set ROS alias command
alias cw='cd ~/catkin_ws'
alias cs='cd ~/catkin_ws/src'
alias cm='cd ~/catkin_ws && catkin_make'
测试
终端执行
roscore
新的终端执行
rosrun turtlesim turtlesim_node
正常情况下会出现
新终端执行
rosrun turtlesim turtle_teleop_key
在命令终端窗口,方向键 控制运动 不是乌龟的窗口的页面
网友评论