0
$\begingroup$

Environment Information:

  • ROS 2 Distribution: Humble
  • Operating System: Ubuntu 22.04
  • Python Version: 3.10.12

MoveIt Installation:

sudo apt-get install ros-humble-moveit

Code Snippet (filename: server_node.py)

#!/usr/bin/env python3 
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import PoseStamped
from moveit_msgs.srv import GetPositionIK
from moveit_msgs.msg import PositionIKRequest, RobotTrajectory
from trajectory_msgs.msg import JointTrajectory, JointTrajectoryPoint
from moveit_msgs.msg import MoveItErrorCodes
from sensor_msgs.msg import JointState
from moveit_ros_planning_interface import MoveGroupInterface
from moveit_ros_planning_interface import PlanningSceneInterface
from moveit_ros_planning_interface import RobotCommander

Error Message:

Traceback (most recent call last):
  File "/home/ubuntu/palletizer/src/my_palletizer/my_palletizer/server_node.py", line 10, in <module>
    from moveit_ros_planning_interface import MoveGroupInterface
ModuleNotFoundError: No module named 'moveit_ros_planning_interface'

Workspace Structure:

/palletizer
|-- build
|-- install
|-- log
|-- src
    |-- moveit
    |-- my_palletizer
        |-- my_palletizer
            |-- build
            |-- __init__.py
            |-- log
            |-- server_node.py
            |-- CMakeLists.txt
            |-- install
            |-- publisher_node.py
            |-- subscriber_node.py
            |-- package.xml
            |-- resource
            |-- setup.cfg
            |-- setup.py
            |-- test

Steps Taken for Debugging:

  • Installed MoveIt using the provided command.
  • Verified the presence of MoveIt in the ROS 2 workspace.

Specific Questions:

  1. How can I resolve the ModuleNotFoundError: No module named 'moveit_ros_planning_interface' issue?
  2. Are there additional dependencies or configurations needed for MoveIt in ROS 2 Humble?
  3. Is there an alternative way to import moveit_ros_planning_interface in ROS 2 Humble?

Any guidance or suggestions on resolving this issue would be greatly appreciated. Thank you!

$\endgroup$

1 Answer 1

0
$\begingroup$

Welcome to Robotics Stack Exchange!

from moveit_ros_planning_interface import MoveGroupInterface

You are using MoveIt 1 on ROS 2. The MoveIt 2 has been rewritten for ROS 2, and the Python library has been renamed MoveItPy.

Documentation

  1. Documentation: Please check the official Motion Planning Python API page.
  2. Sample Code: Please check the ros-planning/moveit2_tutorials repository.

Installation

From ROS Iron onwards, you can install it directly from apt using the following command:

sudo apt install ros-${ROS_DISTRO}-moveit-py

For ROS Humble, you can compile the main branch of ros-planning/moveit2. Please feel free to share if there is any issues in source installation.

Verification

After successful installation, you should be able to import MoveItPy as shown below:

$ source /opt/ros/iron/setup.bash
$ python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from moveit.core.robot_state import RobotState
>>> from moveit.planning import MoveItPy, MultiPipelinePlanRequestParameters
>>> 
>>> exit()
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.