Install ros2--galactic version on ubuntu20.04

 Install ros2--galactic version on ubuntu20.04, and some environment configurations

 Look at the official documentation:

Ubuntu (Debian) - ROS 2 Documentation: Galaxy Documentation

official installation

1. Check the encoding format: require locale to support UTF-8

locale  # check for UTF-8

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

locale  # verify settings

2. Add ROS 2 apt repository

sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl
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 $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

3. Install the ROS 2 package 

sudo apt update
sudo apt upgrade
sudo apt install ros-galactic-desktop
sudo apt install ros-galactic-ros-base
sudo apt install ros-dev-tools
sudo apt upgrade
sudo rosdep init
rosdep update

 Done, enter the example test

. ~/ros2_galactic/install/local_setup.bash
ros2 run demo_nodes_cpp talker
 

If you think the official installation is too troublesome, you can use Xiaoyu's one-click installation to save time and worry. 

One-click installation environment of Yuxiang ros

Terminal input command:

wget http://fishros.com/install -O fishros && . fishros

1. Install ros2--galactic

Select numbers:

[1]: One-click installation: ROS (supports ROS and ROS2, Raspberry Pi Jetson)

[1]: Replace the system source and continue the installation

[3]:galactic(ROS2)

[1]: galactic (ROS2) desktop version

2. Install the VScode environment

[7]: One-click installation: VsCode development tools

Install the plugin:

Chinese language pack, vscode-icons,

Python ,Pylance,C++  ,C/C++ Themes,C/C++ Extension Pack,CMake,CMake Tools,

ROS    ,RTOS Views,Rosbag Preview ,URDF

Msg Language Support    ,Visual Studio IntelliCode       ,Markdown All in One

Docker, Cortex-Debug, debug-tracker-vscode, MemoryView, translation (English-Chinese dictionary)

Rviz visualization tool

Since rviz2 has already been installed when installing ros2 with one click, there is no need to install it here 

sudo apt install ros-galactic-rviz2

Gazebo simulation:

install command 

sudo apt install gazebo11
 

foxglove tool

Installation:  Download - Foxglove

See the live connection section Live connection: ROS 2 - Docs - Foxglove

Directly git clone https://github.com/foxglove/ros-foxglove-bridge.git to the src folder of the workspace and then colcon build along with the project to visualize it

cd ws
git clone https://github.com/foxglove/ros-foxglove-bridge.git src/ros-foxglove-bridge

rosdep update
rosdep install --ignore-src --default-yes --from-path src
编译
colcon build --event-handlers console_direct+ --symlink-install
source install/local_setup.bash

Start the bridge to bind the port

ros2 launch foxglove_bridge foxglove_bridge_launch.xml port:=8765

Guess you like

Origin blog.csdn.net/qq_64079631/article/details/131755110