Reference materials for this article: (VPN access required) cn/noetic/Installation/Ubuntu - ROS Wikihttp://wiki.ros.org/cn/noetic/Installation/Ubuntu
ROS is an open source meta operating system for robots. In fact, it is not a real operating system. Its underlying tasks such as task scheduling, compilation and addressing are still completed by the Linux operating system, that is to say, ROS is actually a secondary operating system running on Linux. However, ROS provides various services for operating system applications (such as hardware abstraction, underlying device control, common function implementation, inter process message passing, software package management, etc.), as well as tools and functions for obtaining, compiling and cross platform running code. ROS mainly adopts loose coupling point-to-point process network communication. At present, it mainly supports Ubuntu system. At present, windows and Mac OS do not support well, so it is recommended to install ROS on Ubuntu system.
To sum up, using ROS can easily and quickly build a robot prototype. We can control the actual robot or unmanned vehicle through this system.
In the previous blog, we have installed Ubuntu 20 04. Next, we need to install the corresponding ROS Noetic.
1. Set sources list
Set up your computer to install from packages ros. Org software
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'
2. Set key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
If you cannot connect to the key server, you can try to replace the key in the above command hkp://keyserver.ubuntu.com:80 For hkp://pgp.mit.edu:80 .
You can also use curl command to replace apt key command, which is more useful when using proxy server:
curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
3. Start installation
First update to ensure that the Debian package index is up-to-date:
sudo apt update
Full desktop installation:
sudo apt install ros-noetic-desktop-full
4. Setting environment
You need to source this script in each bash terminal using ROS:
The following commands can automatically source this script for you every time you start a new shell window:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc
echo "source /opt/ros/noetic/setup.zsh" >> ~/.zshrc source ~/.zshrc
II management environment
You can see setup in the / opt / ROS / < distro > / directory* SH file to execute the following source command:
Each time you open the terminal, you need to run the above command before accessing ROS related commands. In order to avoid this cumbersome process, you can Add this command to the bashrc file.
III Create ROS workspace
Now let's start creating and building a catkin workspace:
mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make
You should see the other two directories, devel and build. You can see several setups in the devel folder* SH file. source any of these files can set the current workspace at the top level of the environment. Next, first click the newly generated setup* SH file:
To ensure that the workspace is correctly covered by the installation script, ROS needs to be determined_ PACKAGE_ The path environment variable contains your current workspace Directory:
echo $ROS_PACKAGE_PATH /home/<username>/catkin_ws/src:/opt/ros/noetic/share
< username > change to your own username.
So far, the environment has been built
5. Test whether ROS is installed successfully
Little turtle test:
Open the Ubuntu terminal and enter:
Open another Ubuntu terminal and enter:
rosrun turtlesim turtlesim_node
At this point, a small turtle image will pop up.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-username'
Don't worry, ROS can still be used. I later uninstalled Ubuntu and reinstalled ROS, which disappeared by itself.
Open the third Ubuntu terminal and enter:
rosrun turtlesim turtle_teleop_key
Place the mouse arrow in the third terminal and make the third terminal active. You can control the movement of the little turtle through the direction key of the keyboard, which indicates that ROS is successfully installed.