[ROS system] Install ROS2 system in Ubuntu22.04 system_ubuntu install ros2_GoesM
Excerpt
ROS simulation, system platform specially provided for autonomous driving research and development_ubuntu install ros2
Reference blog: ROS installation detailed tutorial - Ubuntu22.0.4 LTS installation
Part 0. Preparation
First, we need an Ubuntu system .
Part 1. Adjust the relevant configuration in the Ubuntu system
step 1. Set the language
Terminal input command:
sudo apt update
sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
step 2. Set mirror source
Set up from the ubuntu system interface:
Settings->Software Upgrade->Ubuntu software->source code Select the domestic mirror source for the source code
Make sure the mirror source is available
Make sure the Ubuntu Universe repository is enabled by checking the output of this command.
apt-cache policy | grep universe
If it outputs "500: a mess", it works.
If there is no above output, you need to execute the command:
sudo apt install software-properties-common
sudo add-apt-repository universe
step 3. Download related files from github
Terminal command:
sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
step 4. Update the above configuration to the system
Instructions: sudo apt-get update
Instructions:sudo apt-get upgrade
Part 2. Install the ROS2-humble system
step 1. Download the ROS system
Instructions: sudo apt install ros-humble-desktop
Note 1: humble means the version name, different Ubuntu systems need to download the corresponding different version names, ubuntu22.04 corresponds to the version humble, other versions can be viewed on the ROS official website; Note 2: desktop means the desktop version, that is, the full
version , to automatically install our commonly used functions.
step 2. Adjust the configuration
Terminal command:source /opt/ros/humble/setup.bash echo " source /opt/ros/humble/setup.bash" >> ~/.bashrc
Part 3. Check whether the ROS2-humble system can run normally
communication test
Open a terminal, command: ros2 run demo_nodes_cpp talker
open another terminal, command: ros2 run demo_nodes_py listener
if the listener can display the signal from the talker normally, it means normal.
Small turtle simulation test
One terminal, command: ros2 run turtlesim turtlesim_node
start the turtle emulator
Another terminal, command: ros2 run turtlesim turtle_teleop_key
start the keyboard control node
If you can control the movement of the little turtle normally through the keyboard, it means normal.
Part 4. ROS2 system file location
Query in the file directory: /opt/ros/humble