Ubuntu22.04 + ROS2 Humble配置Moveit2环境

server/2024/9/24 12:38:38/

Ubuntu22.04 + ROS2 Humble配置Moveit2环境

文章目录

  • Ubuntu22.04 + ROS2 Humble配置Moveit2环境
    • 1.Ubuntu22.04配置ROS2
    • 2.二进制安装Moveit2
    • 3.配置Moveit的官方教程
      • 3.1安装rosdep
      • 3.2下载moveit的tutorials
      • 3.3安装中间件Middleware
    • 4.启动测试用例
    • Reference

环境配置:

  • ubuntu 22.04
  • ROS2 humble
  • moveit2

1.Ubuntu22.04配置ROS2

配置Ubuntu22.04 + ROS2 Humble这里就不再介绍了,详细可以参考这篇Ubuntu22.04 + ROS2 Humble的环境配置

2.二进制安装Moveit2

其实安装moveit2只需要一句话

sudo apt install ros-humble-moveit

运行不报错即代表安装成功

3.配置Moveit的官方教程

3.1安装rosdep

打开一个新的terminal

source /opt/ros/humble/setup.bash
sudo apt install python3-rosdep

然后初始化rosdep,并更新环境的依赖

sudo rosdep init
rosdep update
sudo apt update
sudo apt dist-upgrade

使用mixin构建环境

sudo apt install python3-colcon-common-extensions
sudo apt install python3-colcon-mixin
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default

安装vcstool

sudo apt install python3-vcstool

3.2下载moveit的tutorials

首先创建一个工作空间

mkdir -p ~/ws_moveit2/src
cd ~/ws_moveit2/src
git clone --branch humble https://github.com/ros-planning/moveit2_tutorials

可以在ws_moveit2/src/moveit2_tutorials文件夹下找到moveit2_tutorials.repos文件,该文件的内容如下:

repositories:launch_param_builder:type: giturl: https://github.com/PickNikRobotics/launch_param_builderversion: mainmoveit2:type: giturl: https://github.com/ros-planning/moveit2version: humblemoveit_resources:type: giturl: https://github.com/ros-planning/moveit_resourcesversion: humblemoveit_task_constructor:type: giturl: https://github.com/ros-planning/moveit_task_constructor.gitversion: humblemoveit_visual_tools:type: giturl: https://github.com/ros-planning/moveit_visual_toolsversion: ros2rosparam_shortcuts:type: giturl: https://github.com/PickNikRobotics/rosparam_shortcutsversion: ros2srdfdom:type: giturl: https://github.com/ros-planning/srdfdom.gitversion: ros2

这个文件里包含了moveit2的及其相关依赖的源码,我们还需要将这些仓库和对应分支的代码克隆下来,

vcs import < moveit2_tutorials/moveit2_tutorials.repos

如果克隆失败,repos文件中的https://github.com/前都加上前缀https://ghproxy.com/,然后再克隆一次,如果成功会出现如下的信息

=== ./launch_param_builder (git) ===
Cloning into '.'...
=== ./moveit2 (git) ===
Cloning into '.'...
=== ./moveit_resources (git) ===
Cloning into '.'...
=== ./moveit_task_constructor (git) ===
Cloning into '.'...
=== ./moveit_visual_tools (git) ===
Cloning into '.'...
=== ./rosparam_shortcuts (git) ===
Cloning into '.'...
=== ./srdfdom (git) ===
Cloning into '.'...

然后安装剩余的依赖

sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y

出下如下的结果则成功

Unpacking ros-humble-forward-command-controller (2.34.0-1jammy.20240404.132907) ...
Selecting previously unselected package ros-humble-position-controllers.
Preparing to unpack .../ros-humble-position-controllers_2.34.0-1jammy.20240404.133529_amd64.deb ...
Unpacking ros-humble-position-controllers (2.34.0-1jammy.20240404.133529) ...
Setting up ros-humble-forward-command-controller (2.34.0-1jammy.20240404.132907) ...
Setting up ros-humble-position-controllers (2.34.0-1jammy.20240404.133529) ...
#All required rosdeps installed successfully

最后我们可以进入工作空间然后开始编译了

cd ~/ws_moveit2
colcon build --mixin release

这个编译的时间可能会很久,请耐心等待。

3.3安装中间件Middleware

官方推荐使用Cyclone DDS作为中间件的解决方案

sudo apt install ros-humble-rmw-cyclonedds-cpp

截至 2022 年 9 月 26 日,默认的 ROS 2 中间件 (RMW) 实现存在问题。 作为解决方法,请切换到 Cyclone DDS。所以我们需要在~/.bashrc文件中添加这样一句话

# You may want to add this to ~/.bashrc to source it automatically
# >>> moveit2 Cyclone DDS <<<
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

4.启动测试用例

进入我们的工作空间

cd ~/ws_moveit2/src
source intsall/setup.bash

然后直接启动

ros2 launch moveit2_tutorials demo.launch.py rviz_config:=panda_moveit_config_demo_empty.rviz

然后会出现一个空白的rviz2的界面

Image

然后选择Add > MotionPlanning就会出现一个机械臂的模型,接下来就可以安装官方的教程开始学习了。

Image

Reference

[1]MoveIt 2 Binary Install

[2]MoveIt Quickstart in RViz

[3]《动手学Moveit2》3.安装Moveit2测试


http://www.ppmy.cn/server/11222.html

相关文章

寻找php全栈程序员

岗位职责&#xff1a; 负责公司线上产品的前台和后台开发。 注意&#xff1a;本工作为远程工作岗位&#xff0c;请仔细考虑再投简历。 任职要求&#xff1a; 1. 本科及以上学历&#xff0c;计算机专业.软件工程专业背景优先&#xff1b; 2. 有PHP&#xff0c; Yii框架开发工…

数据结构——栈(C++实现)

数据结构——栈 什么是栈栈的实现顺序栈的实现链栈的实现 今天我们来看一个新的数据结构——栈。 什么是栈 栈是一种基础且重要的数据结构&#xff0c;它在计算机科学和编程中扮演着核心角色。栈的名称源于现实生活中的概念&#xff0c;如一叠书或一摞盘子&#xff0c;新添加…

谷歌收录工具有什么好用的?

如果是想促进谷歌的收录&#xff0c;其实能用的手段无非就两个&#xff0c;谷歌GSC以及爬虫池 谷歌gsc就不用说了&#xff0c;作为谷歌官方提供的工具&#xff0c;他能提供最准确的数据&#xff0c;并且可以提交每天更新的链接&#xff0c;进而促进收录&#xff0c;只要你的页面…

Java基本语法(基础部分)

Java基本语法 文章目录 Java基本语法前言一、准备工作1.1 计算机软件与硬件1.2 计算机编程语言1.3 Java语言概述&程序分析1.4 Java环境搭建&Java API1.5 Java核心机制JVM 二、变量2.1 关键字&标识符2.2 变量2.3 数据类型(基本数据类型)2.3.1 基本数据类型2.3.2 基本…

代码随想录训练营Day 29|Python|Leetcode|● 860.柠檬水找零 ● 406.根据身高重建队列 ● 452. 用最少数量的箭引爆气球

860.柠檬水找零 在柠檬水摊上&#xff0c;每一杯柠檬水的售价为 5 美元。顾客排队购买你的产品&#xff0c;&#xff08;按账单 bills 支付的顺序&#xff09;一次购买一杯。 每位顾客只买一杯柠檬水&#xff0c;然后向你付 5 美元、10 美元或 20 美元。你必须给每个顾客正确…

基于python的pdf版本的PPT转换为office PPT

简介 pdf2pptx是一个基于Python的命令行工具,可以将PDF格式的演示文稿批量转换为Microsoft Office PowerPoint(.pptx)格式的演示文稿。该项目利用了Python的强大功能和多个第三方库,如PyMuPDF(又称fitz)和python-pptx,以实现高效、准确的转换。 项目功能: 批量转换:…

从零开始学习Linux(4)----yum和vim

1.Linux软件包管理器yum Linux中我们要进行工具/指令/程序&#xff0c;安装&#xff0c;检查卸载等&#xff0c;需要yum的软件 安装软件的方式&#xff1a; 源代码安装---交叉编译的工具rpm包直接安装yum/apt-get yum是我们Linux预装的一个指令&#xff0c;搜索&#xff0c;下…

springboot-异步、定时、邮件任务

目录 一&#xff0c;前言 二&#xff0c;异步 2.1&#xff0c;案例&#xff1a; 1&#xff0c;首先创建一个service&#xff1a; 2&#xff0c;Controller: ① 想办法告诉spring我们的异步方法是异步的&#xff0c;所以要在方法上添加注解 Async ②去springboot主程序中开…