Ubuntu22.04 + ROS2 Humble配置Moveit2环境

Ubuntu22.04 + ROS2 Humble配置Moveit2环境

环境配置:

  • 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: git
    url: https://github.com/PickNikRobotics/launch_param_builder
    version: main
  moveit2:
    type: git
    url: https://github.com/ros-planning/moveit2
    version: humble
  moveit_resources:
    type: git
    url: https://github.com/ros-planning/moveit_resources
    version: humble
  moveit_task_constructor:
    type: git
    url: https://github.com/ros-planning/moveit_task_constructor.git
    version: humble
  moveit_visual_tools:
    type: git
    url: https://github.com/ros-planning/moveit_visual_tools
    version: ros2
  rosparam_shortcuts:
    type: git
    url: https://github.com/PickNikRobotics/rosparam_shortcuts
    version: ros2
  srdfdom:
    type: git
    url: https://github.com/ros-planning/srdfdom.git
    version: 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测试

相关推荐

  1. ROS 2 Humble (Ubuntu Jammy)安装配置

    2024-04-23 21:54:03       41 阅读
  2. ROS2 ZEDX UBUNTU 环境配置

    2024-04-23 21:54:03       10 阅读
  3. 树莓派 ubuntu22.04 meta安装 ros2-humble

    2024-04-23 21:54:03       11 阅读
  4. ubuntu-meta-22.04桌面版+ros2-humble 镜像

    2024-04-23 21:54:03       11 阅读
  5. Universal_Robots_ROS2_Driver 安装问题详解(humble

    2024-04-23 21:54:03       14 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-23 21:54:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-23 21:54:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-23 21:54:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-23 21:54:03       20 阅读

热门阅读

  1. MySQL 基础语法(3)

    2024-04-23 21:54:03       12 阅读
  2. Shell中grep用法总结

    2024-04-23 21:54:03       11 阅读
  3. 管理科学-运输问题(伏格尔法)

    2024-04-23 21:54:03       13 阅读
  4. MySQL常见问题汇总

    2024-04-23 21:54:03       14 阅读
  5. webview透明

    2024-04-23 21:54:03       10 阅读
  6. Linux为根目录扩容

    2024-04-23 21:54:03       12 阅读
  7. 【K8S系列】深入解析K8S中PV 和PVC

    2024-04-23 21:54:03       13 阅读
  8. 关于ABB怎么回原点最简单的方法

    2024-04-23 21:54:03       18 阅读
  9. Python的pytest框架(4)--参数化测试

    2024-04-23 21:54:03       16 阅读
  10. idea 切换分支后 Project目录树小消失

    2024-04-23 21:54:03       13 阅读
  11. K8S 哲学 - yaml文件

    2024-04-23 21:54:03       11 阅读