检查编码格式:要求locale支持UTF-8
locale
设置en_US.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
apt-cache policy | grep universe
观察是否有以下字符 500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=amd64
安装
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
sudo apt update && sudo apt install -y \
build-essential \
cmake \
git \
python3-colcon-common-extensions \
python3-flake8 \
python3-pip \
python3-pytest-cov \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget
安装
python3 -m pip install -U \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest \
setuptools
二进制安装
sudo apt install ros-galactic-desktop
源码下载
mkdir -p ~/ros2_galactic/src
cd ~/ros2_galactic
wget https://raw.githubusercontent.com/ros2/ros2/galactic/ros2.repos
vcs import src < ros2.repos
sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-5.3.1 urdfdom_headers"
编译
cd ~/ros2_galactic/
colcon build --symlink-install
环境变量
. ~/ros2_galactic/install/local_setup.bash
例子
. ~/ros2_galactic/install/local_setup.bash
ros2 run demo_nodes_cpp talker
. ~/ros2_galactic/install/local_setup.bash
ros2 run demo_nodes_py listener
sudo apt install clang
export CC=clang
export CXX=clang++
colcon build --cmake-force-configure
参考
https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html
|