Ubuntu22.04安装ROS2

1.设置 ROS 2 的软件包源

复制代码
sudo apt update
sudo apt install -y curl gnupg2 lsb-release

2.添加ROS2源

复制代码
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2.list'

3.安装ROS2

复制代码
sudo apt update
sudo apt install -y ros-humble-desktop

注意:可能会报错https://packages.ros.org/ros2/ubuntu jammy InRelease

Certificate verification failed: The certificate is NOT trusted. The name in the certificate does not match the expected. Could not handshake: Error in the certificate verification

解决方法:

1)进入文件夹 : cd /etc/apt/sources.list.d

2)打开文件: sudo vim ros2.list

3)将https改为http 后保存。重新执行以上代码

4.设置环境变量

复制代码
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source ~/.bashrc

5.安装开发工具

复制代码
sudo apt install -y python3-colcon-common-extensions

6.查看版本

复制代码
echo $ROS_DISTRO

7.创建一个ros2工作区

复制代码
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
colcon build
source install/setup.bash

8.运行一个示例

复制代码
sudo apt-get install ros-humble-demo-nodes-cpp
ros2 run demo_nodes_cpp talker

ros2 run demo_nodes_cpp listener
复制代码

参考:Ubuntu (source) --- ROS 2 Documentation: Rolling documentation

相关推荐
曹勖之1 天前
撰写脚本,通过发布/joint_states话题改变机器人在Rviz中的关节角度
开发语言·python·机器人·ros2
曹勖之2 天前
在MATLAB中使用自定义的ROS2消息
开发语言·matlab·机器人·ros·simulink·ros2
Mr.Winter`12 天前
运动规划实战案例 | 图解基于状态晶格(State Lattice)的路径规划(附ROS C++/Python仿真)
c++·人工智能·机器人·自动驾驶·ros·ros2
laocui118 天前
Launch文件笔记: 二、加载GAZEBO文件
笔记·ros2·gazebo·launch
@Ming-1 个月前
AimRT 从零到一:官方示例精讲 —— 五、Parameter示例.md
机器人·ros2·aimrt
维度攻城狮1 个月前
通过DeepSeek大语言模型控制panda机械臂,听懂人话,拟人性回答。智能机械臂助手又进一步啦
大语言模型·控制·ros2·moveit·deepseek·rviz2
Mr.Winter`1 个月前
无人船 | 图解基于LQR控制的路径跟踪算法(以全驱动无人艇WAMV为例)
人工智能·算法·机器人·ros·ros2·运动规划·无人船
aspirestro三水哥1 个月前
解决ROS2安装过程中无法连接raw.githubusercontent.com的问题
机器人·ros2
Mr.Winter`2 个月前
无人船 | 图解基于PID控制的路径跟踪算法(以欠驱动无人艇Otter为例)
人工智能·算法·机器人·自动驾驶·ros·ros2·无人船
Mr.Winter`2 个月前
无人船 | 图解基于PID控制的路径跟踪算法(以全驱动无人艇WAMV为例)
人工智能·机器人·ros·ros2·路径规划·无人船