MoveIt 1 Source Build: Linux

MoveIt 1 Source Build: Linux(原址太慢了)

Installing MoveIt from source is the first step in contributing new features, optimizations, and bug fixes back to the open source project. Thanks for getting involved!

MoveIt is mainly supported on Linux, and the following build instructions support in particular:

In the future, we would like to expand our source build instructions to more OS's, please contribute!

Prerequisites

Install

Follow all the instructions to install ROS. Please make sure you have followed all steps and have the latest versions of packages installed:

rosdep update
sudo apt-get update
sudo apt-get dist-upgrade

Source installation requires wstool, catkin_tools, and optionally clang-format:

sudo apt-get install python-wstool python-catkin-tools clang-format-3.9

Create Workspace and Source

Optionally create a new workspace, you can name it whatever:

mkdir ~/ws_moveit
cd ~/ws_moveit

Next, source your ROS workspace to load the necessary environment variables, depending on what version of ROS you installed.

Choose one of the two:

source /opt/ros/melodic/setup.bash
source /opt/ros/kinetic/setup.bash

This will load the ${ROS_DISTRO} variable, needed for the next step.

Download Source Code

By default, we will assume you are building the latest branch: master. This branch builds for ROS Kinetic and newer, e.g. on Ubuntu 16.04 and newer. If you would like to build an older release of MoveIt from source, see the section below.

Pull down required repositories and build from within the root directory of your catkin workspace:

wstool init src
wstool merge -t src https://raw.githubusercontent.com/ros-planning/moveit/master/moveit.rosinstall
wstool update -t src
rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO}
catkin config --extend /opt/ros/${ROS_DISTRO} --cmake-args -DCMAKE_BUILD_TYPE=Release

Optional: Excluding Packages from a Build

MoveIt is a large project and the default compile time can easily take around 30 minutes. If you would like to reduce your compile time or only need to build a subset of all the packages, catkin allows you to configure only a subset of packages to include in a build. Be careful not to disable packages that are needed by others (ie: are a dependency of other packages). You can exclude packages from a build in several ways:

  • catkin-tools --blacklist (recommended)
  • touch /path/to/package/directory/CATKIN_IGNORE
  • rm -rf /path/to/package/directory

Here we show some examples using catkin_tools. Note: If you have already built these packages in your workspace you will need to use catkin clean first.

Disable All High-Level User Interfaces (optional)

catkin config --blacklist \
                moveit_commander \
                moveit_setup_assistant \
                moveit_ros_robot_interaction \
                moveit_ros_visualization \
                moveit_ros_benchmarks \
                moveit_controller_manager_example \
                moveit_ros_warehouse \
                moveit_ros_manipulation \
                moveit_visual_tools \
                rviz_visual_tools

Disable CHOMP Motion Planner (optional)

Note, every command to catkin config --blacklist will override the previous list by default. Using the option --append-args you can augment the existing blacklist.

catkin config --blacklist \
        moveit_chomp_optimizer_adapter \
        moveit_planners_chomp \
        chomp_motion_planner

Optional: Install a Compiler Cache

Building all or even just some of MoveIt from source can take up to an hour. A compiler cache can reduce this time to a few minutes by preventing unchanged files from being recompiled. The most prominent compiler cache is ccache suitable for gcc and other similar compilers.

Installation

On a Debian or Ubuntu system, installing ccache is simple:

sudo apt-get install ccache

For other OS, consult the package manager or software store and search for ccache. Refer to the ccache website for more information on downloading and installation.

Setup

To use ccache it must be explicitly configured - just installing the package is not enough. To automatically use ccache with all supported compilers prepend the /usr/lib/ccache directory to your PATH (for systems other than Debian or Ubuntu this directory may vary). It is easy to enable ccache on startup in bash. For other shells or systems adapt the commands appropriately.

echo 'export PATH=/usr/lib/ccache:$PATH' >> $HOME/.bashrc
source $HOME/.bashrc

To use caching for specific projects only, set the CC and CXX environment variables to a compiler proxy listed in /usr/lib/ccache before invoking make, cmake, catkin_make or catkin build.

Using ccache

If setup, ccache is used automatically.

To view the statistics on hit ratios and cache usage use the command below.

ccache --show-stats

Note: ccache can only cache compiler output if the compiler is actually triggered. If a catkin workspace has already been built, enabling ccache and rebuilding the workspace will not result in any caching. To seed ccache, clean out the *build* and *devel* spaces of the workspace and start from scratch. This can be done by either removing them manually (rm -rf build devel) or with catkin_tools (catkin clean -y).

Build MoveIt

catkin build

Source the Catkin Workspace

Setup your environment - you can do this every time you work with this particular source install of the code, or you can add this to your .bashrc (recommended):

source ~/ws_moveit/devel/setup.bash # or .zsh, depending on your shell

Quick Start

Start planning in Rviz with:

MoveIt Getting Started Tutorial

Advanced

Building Older Releases Of MoveIt

It's best to contribute to our latest branch, even if you're still on an earlier version of Ubuntu. However our latest branch does not support older versions of ROS such as ROS Indigo. Use the following command to build older releases from source:

wstool init src
wstool merge -t src https://raw.githubusercontent.com/ros-planning/moveit/${ROS_DISTRO}-devel/moveit.rosinstall
wstool update -t src
rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO}
catkin config --extend /opt/ros/${ROS_DISTRO} --cmake-args -DCMAKE_BUILD_TYPE=Release
catkin build

Build Dependencies From Source

For MongoDB, OMPL, or FCL source installs, see Building Common MoveIt Dependencies from Source in Catkin.

ros2@Humble:~/moveit2_ws$ ros2 run moveit_setup_assistant moveit_setup_assistant QSocketNotifier: Can only be used with threads started with QThread terminate called after throwing an instance of 'ament_index_cpp::PackageNotFoundError' what(): package 'jb' not found, searching: [/home/ros2/moveit2_ws/install/moveit_resources_prbt_support, /home/ros2/moveit2_ws/install/moveit_configs_utils, /home/ros2/moveit2_ws/install/moveit_common, /opt/ros/humble] Stack trace (most recent call last): #31 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e3372e46, in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) #30 Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.3", at 0x7487e26b9e39, in QCoreApplication::notifyInternal2(QObject*, QEvent*) #29 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e3374363, in QApplication::notify(QObject*, QEvent*) #28 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e336c712, in QApplicationPrivate::notify_helper(QObject*, QEvent*) #27 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e33af4ed, in QWidget::event(QEvent*) #26 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e34641e6, in QAbstractButton::mouseReleaseEvent(QMouseEvent*) #25 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e3463fc3, in #24 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e346239d, in #23 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e3462115, in QAbstractButton::clicked(bool) #22 Object "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5.15.3", at 0x7487e26f17c7, in #21 Object "/opt/ros/humble/lib/libmoveit_setup_framework.so", at 0x7487e3eb35ef, in moveit_setup::LoadPathWidget::btnFileDialog() #20 Object "/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.15.3", at 0x7487e34c2a91, in QWidgetLineControl::internalSetTe
最新发布
04-01
<think>好的,我现在需要解决用户提到的在ROS2 Humble中运行MoveIt Setup Assistant时出现的QSocketNotifier和ament_index_cpp::PackageNotFoundError问题。首先,我得回忆一下ROS2和MoveIt的基本知识,以及常见的错误处理方法。 用户提到的两个错误:QSocketNotifier和ament_index_cpp::PackageNotFoundError。QSocketNotifier可能与QT或GUI相关的库有关,而PackageNotFoundError通常是由于缺少依赖或环境变量未正确设置引起的。我需要分步骤分析可能的原因。 首先,PackageNotFoundError。这可能是因为所需的软件包没有安装,或者安装路径没有被正确识别。ROS2使用ament构建系统,ament_index_cpp是用于查找软件包的工具。如果用户自己创建的机械臂模型找不到相关配置包,可能需要检查包的安装情况,或者确认是否在正确的环境中编译和source了工作空间。 然后,QSocketNotifier错误。这可能涉及到GUI工具中的网络套接字问题,或者与ROS2的通信机制(如DDS)不兼容。另外,可能缺少某些QT依赖库,或者环境变量如DISPLAY未正确设置,尤其是在远程连接时容易出现这个问题。 接下来,我应该考虑解决方案的步骤: 1. 确保所有依赖项已正确安装,特别是MoveIt相关的包。用户可能需要安装moveit_visual_tools等包,如引用[2]提到的CMakeLists.txt中添加的依赖项。 2. 检查工作空间的编译和source过程。用户是否正确编译了工作空间,并在运行前source了install/setup.bash?如果软件包没有被正确识别,可能是因为环境变量未更新。 3. 检查包的创建和配置。引用[3]提到,如果硬件接口的包不存在,需要用ros2 pkg create创建,并确保类型为ament_cmake。用户的自定义机械臂模型可能需要正确配置package.xml和CMakeLists.txt,确保所有依赖项声明正确。 4. 对于QSocketNotifier错误,可能需要安装额外的QT库,比如在Ubuntu上安装libqt5gui5或者相关的开发包。此外,检查DISPLAY环境变量是否设置正确,尤其是在使用远程桌面或SSH时,可能需要配置X11转发。 5. 如果问题仍然存在,可能需要重新安装MoveIt Setup Assistant和相关组件,或者检查ROS2 Humble和MoveIt的版本兼容性。有时,更新到最新版本或回退到稳定版本可以解决问题。 最后,用户提供的引用[4]中提到了运行demo.launch.py时的配置问题,可能和MoveIt的配置文件生成有关。确保使用MoveItConfigsBuilder正确构建配置,并且生成的launch文件无误。可能需要检查生成的配置是否包含所有必要的依赖和参数。 总结下来,解决方案应该包括安装缺失的依赖、正确配置工作空间和环境变量、检查QT相关设置,以及验证包的创建和编译过程。</think>### 逐步解决方案 #### 问题分析 在ROS2 Humble中运行`moveit_setup_assistant`时出现`QSocketNotifier`和`ament_index_cpp::PackageNotFoundError`错误,通常由以下原因导致: 1. **依赖缺失**:MoveIt相关软件包或QT库未安装。 2. **环境配置错误**:工作空间未正确编译或环境变量未设置。 3. **自定义模型配置错误**:机械臂模型的包未正确定义或依赖未声明。 --- ### 步骤1:安装必要依赖 1. **安装MoveIt核心组件**: ```bash sudo apt install ros-humble-moveit ros-humble-moveit-visual-tools ros-humble-moveit-resources ``` 确保`moveit_visual_tools`等依赖已安装[^2]。 2. **安装QT依赖**: ```bash sudo apt install libqt5gui5 libqt5core5a ``` 修复QT相关错误(如`QSocketNotifier`)。 --- ### 步骤2:验证工作空间配置 1. **重新编译工作空间**: ```bash cd ~/ros_ws colcon build --symlink-install source install/setup.bash ``` 确保自定义机械臂的包被正确编译[^3]。 2. **检查`package.xml`**: ```xml <depend>moveit_core</depend> <depend>moveit_visual_tools</depend> ``` 确保所有MoveIt依赖项已声明[^2][^4]。 --- ### 步骤3:修复PackageNotFoundError 1. **确认包路径**: 运行`echo $AMENT_PREFIX_PATH`,检查是否包含自定义机械臂包的路径。 2. **重新创建包**: ```bash ros2 pkg create --build-type ament_cmake your_package_name ``` 使用`ament_cmake`构建类型确保兼容性。 --- ### 步骤4:处理QSocketNotifier警告 1. **设置DISPLAY变量**(仅限Linux图形界面): ```bash export DISPLAY=:0 ``` 若通过SSH连接,使用`-X`或`-Y`选项启用X11转发。 2. **检查网络配置**: 确保ROS2的DDS配置(如`CycloneDDS`或`FastDDS`)未与QT冲突。 --- ### 步骤5:重新运行MoveIt Setup Assistant ```bash ros2 launch moveit_setup_assistant setup_assistant.launch.py ``` 若仍报错,尝试更新ROS2和MoveIt到最新版本: ```bash sudo apt update && sudo apt upgrade ros-humble-* ``` --- ### 相关问题 1. 如何验证ROS2环境变量是否正确加载? 2. MoveIt自定义模型需要哪些最小依赖项? 3. 如何调试ROS2中的`ament_index_cpp::PackageNotFoundError`? [^1]: `rosrun moveit_setup_assistant moveit_setup_assistant` [^2]: `CMakeLists.txt`中添加`moveit_visual_tools` : 使用`ros2 pkg create`创建包 : MoveIt配置生成代码示例
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值