在ubuntu20.04安装ros2-- galactic版本,以及一些环境的配置
看官方文档:
Ubuntu (Debian) — ROS 2 文档:银河文档
1.检查编码格式:要求locale支持UTF-8
locale # check for UTF-8sudo 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-8locale # verify settings
2.添加 ROS 2 apt 存储库
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.gpgecho "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.安装ROS 2软件包
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
完成,输入例子测试
. ~/ros2_galactic/install/local_setup.bash
ros2 run demo_nodes_cpp talker
鱼香ros的一键安装环境
终端命令:
wget http://fishros.com/install -O fishros && . fishros
1.安装ros2--galactic
选择数字:
[1]:一键安装:ROS(支持ROS和ROS2,树莓派Jetson)
[1]:更换系统源再继续安装
[3]:galactic(ROS2)
[1]:galactic(ROS2)桌面版
2.安装VScode环境
[7]:一键安装:VsCode开发工具
安装插件:
中文语言包 ,Python ,Pylance,C++ ,C/C++ Themes,C/C++ Extension Pack,CMake,CMake Tools,vscode-icons , ROS ,RTOS Views,Msg Language Support ,Visual Studio IntelliCode ,URDF ,Markdown All in One
Docker,Cortex-Debug,debug-tracker-vscode,MemoryView,翻译(英汉词典)
Rviz可视化工具
由于一键安装ros2的时候已经安装了rviz2,这里不需要再安装
sudo apt install ros-galactic-rviz2
Gazebo仿真:
安装命令
sudo apt install gazebo11
foxglove 工具
安装: Download - Foxglove
看实时连接部分Live connection:ROS 2 - Docs - Foxglove
直接git clone https://github.com/foxglove/ros-foxglove-bridge.git 到workspace的src文件夹 然后跟着项目一起colcon build就能用可视化了
cd ws
git clone https://github.com/foxglove/ros-foxglove-bridge.git src/ros-foxglove-bridgerosdep update
rosdep install --ignore-src --default-yes --from-path src
编译
colcon build --event-handlers console_direct+ --symlink-install
source install/local_setup.bash
启动网桥绑定端口
ros2 launch foxglove_bridge foxglove_bridge_launch.xml port:=8765