Make writing a habit together! This is the 12th day of my participation in the “Gold Digging Day New Plan · April More text Challenge”. Click here for more details.
1 introduction of ROS
1.1 What is ROS?
ROS (Robot Operating System) is an open source meta-operating System for robots. It provides the services that an operating system should have, including
- Hardware abstraction
- Underlying equipment control
- The implementation of common functions
- Interprocess messaging
- Package management
- Tools and library functions needed to get, compile, write, and run code across computers
1.2 Why ROS?
The primary goal of ROS is to provide code reuse support for robotics research and development. In short, avoid reinventing the wheel.
Why ROS improves code reuse?
Because ROS has the concept of packages and feature packs, similar to the concept of libraries in C++ or python, these packages can be easily shared and distributed, and ROS also supports a federated system similar to a code repository, which can also be used for project collaboration and distribution. This design enables the development and implementation of a project to be completely modular, while all projects can be integrated by the ROS infrastructure tools.
In addition, ROS have the following advantages:
- Lean: ROS is designed to be as lean as possible and easy to integrate with other robotics software frameworks
- Language independence: In order to support more application development and migration, ROS is designed as a language-dependent framework structure that defines the message interface between modules in a neutral way.
Java
,C++
,Python
Can be ROS development. - Large applications: ROS is suitable for large runtime systems and large development processes
- Rich componentized toolkit: ROS integrates tools and software into the system in a componentized manner and uses them directly as a component, such as RVIZ, Gazebo, etc., as described below.
- Free and open source: lots of developers, lots of feature packs
2 ROS development process
ROS is a large software project with a long history and many contributors.
Prior to ROS, many scholars believed that robotics research needed an open framework for collaboration, and there were several similar projects dedicated to implementing such a framework.
In 2007, Willow Garage provided significant resources to expand and refine the software systems in Stanford’s robotics program, while the core ideas and basic software packages of ROS have been refined through the efforts of countless researchers.
ROS distributions refer to versions of ROS packages, which are similar in concept to Linux distributions such as Ubuntu. ROS distributions are designed to give developers access to a relatively stable code base until they are ready to version everything up. As a result, after each release, ROS developers usually only fix the bugs in that release, while offering a few improvements to the core package.
Recommended distribution to install: Noetic, Melodic, or Kinetic
3 ROS installation
3.1 Basic Installation
The ROS installation steps are as follows
- Setting the Software Source
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' Copy the code
- Set the secret key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 Copy the code
- Updating software Sources
sudo apt update Copy the code
- Install ROS(Recommended desktop full version installation – included
ROS
,rqt
,rviz
2D/3D emulators, etc.)# kinetic sudo apt install ros-kinetic-desktop-full # noetic sudo apt install ros-noetic-desktop-full # melodic sudo apt install ros-melodic-desktop-full Copy the code
- ROS environment variable configuration
# kinetic echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc # noetic echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc # melodic echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc Copy the code
- Uninstall the ROS
sudo apt remove ros-* Copy the code
3.2 Initializing Rosdep
Rosdep is a ROS command-line tool used to install ROS system dependencies. Rosdep is automatically installed when installing ROS systems, so it does not need to be installed separately, but needs to be initialized and updated.
sudo rosdep init
rosdep update
Copy the code
In the process of initializing ROSDEP, 90% of ROS installed for the first time in China will encounter timeout failure error. The latest solution is recorded here.
Go to rosdistro. Git and download rosdistro-master.zip and place it in your project directory, for example
~/Project/ROS
Copy the code
To modify 20-default.list, run the following command:
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
Copy the code
All of the content of the link to raw.githubusercontent.com in replaced with links to the local file, the last 20 – default. The content of the list as follows:
# os-specific listings first
yaml file:///home/winter/Project/ROS/rosdistro-master/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/winter/Project/ROS/rosdistro-master/rosdep/base.yaml
yaml file:///home/winter/Project/ROS/rosdistro-master/rosdep/python.yaml
yaml file:///home/winter/Project/ROS/rosdistro-master/rosdep/ruby.yaml
gbpdistro file:///home/winter/Project/ROS/rosdistro-master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.y
Copy the code
And then modify the following files, also includes the contents of link to raw.githubusercontent.com all replacement for links to the local files, each file has a need to modify.
1. /usr/lib/python27./dist-packages/rosdep2/gbpdistro_support.py
FUERTE_GBPDISTRO_URL = 'file:///home/winter/Project/ROS/rosdistro-master/releases/fuerte.yaml'
2. /usr/lib/python27./dist-packages/rosdep2/rep3.py
REP3_TARGETS_URL = 'file:///home/winter/Project/ROS/rosdistro-master/releases/targets.yaml'
3. /usr/lib/python27./dist-packages/rosdep2/sources_list.py
DEFAULT_SOURCES_LIST_URL = 'file:///home/winter/Project/ROS/rosdistro-master/rosdep/sources.list.d/20-default.list'
4. /usr/lib/python27./dist-packages/rosdistro/__init__.py
DEFAULT_INDEX_URL = 'file:///home/winter/Project/ROS/rosdistro-master/index-v4.yaml'
Copy the code
3.3 test ROS
The input terminal
roscore
Copy the code
Run the ROS master manager successfully if the following information is displayed
To do the classic turtle test, type:
rosrun turtlesim turtlesim_node
Copy the code
Turtle emulator appears
The input
rosrun turtlesim turtle_teleop_key
Copy the code
Focus the mouse on the third terminal window, and then use the arrow keys on the keyboard to move the little turtle and leave a track on the screen
This indicates that the ROS is installed and configured successfully.
4 FaQs
-
roscore cannot run as another roscore/master is already running. Please kill other roscore/master processes before relaunching.The ROS_MASTER_URI is http://ubuntu:11311/The traceback for the exception was written to the log file
== Solution == : Kill the existing ROS node manager
killall -9 roscore && killall -9 rosmaster Copy the code
-
E: Unable to locate package ros-kinetic-desktop-full
== Solution == : different
ros
Distributions correspond to differentubuntu
Version:Ubuntu16.04
The correspondingros-kinetic
,Ubuntu18.04
The correspondingros-melodic
,Ubuntu20.04
The correspondingros-noetic
. -
rosdep: command not found
== Solution == : Rosdep is not automatically installed during ROS installation, but manually installed
# Ubuntu20.04 sudo apt-get install python3-rosdep # Ubuntu18.04 sudo apt-get install python-rosdep Copy the code
For more content, please follow my AI channel “AI Technology Club “.