Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Moveit2 tutorials -- Motion Planning Python API: with planning_scene_monitor.read_write() as scene: [motion_planning_python_api_planning_scene.py-1] TypeError: Unable to convert function return value to a Python type! #987

Open
Pittmann-XIE opened this issue Nov 13, 2024 · 2 comments

Comments

@Pittmann-XIE
Copy link

Pittmann-XIE commented Nov 13, 2024

Hey, I am following this tutorial "https://moveit.picknik.ai/main/doc/examples/motion_planning_python_api/motion_planning_python_api_tutorial.html#getting-started" and encountered the following error.

Problem

I ran the first part of this tutorial successfully:
ros2 launch moveit2_tutorials motion_planning_python_api_tutorial.launch.py

Then I killed this process and tried to do the second part. As I ran the command:
ros2 launch moveit2_tutorials motion_planning_python_api_tutorial.launch.py example_file:=motion_planning_python_api_planning_scene.py.
I received this error:

[moveit_515746186.moveit.ros.trajectory_execution_manager]: Trajectory execution is managing controllers
[motion_planning_python_api_planning_scene.py-1] [INFO] [1731509289.965633545] [moveit_py_planning_scene]: MoveItPy instance created
[motion_planning_python_api_planning_scene.py-1] TypeError: Unregistered type : planning_scene::PlanningScene
[motion_planning_python_api_planning_scene.py-1]
[motion_planning_python_api_planning_scene.py-1] The above exception was the direct cause of the following exception:
[motion_planning_python_api_planning_scene.py-1]
[motion_planning_python_api_planning_scene.py-1] Traceback (most recent call last):
[motion_planning_python_api_planning_scene.py-1] File "/home/ibrahim-hhi/ws_2/ws_ros_jazzy/ws_moveit/install/moveit2_tutorials/lib/moveit2_tutorials/motion_planning_python_api_planning_scene.py", line 144, in
[motion_planning_python_api_planning_scene.py-1] main()
[motion_planning_python_api_planning_scene.py-1] File "/home/ibrahim-hhi/ws_2/ws_ros_jazzy/ws_moveit/install/moveit2_tutorials/lib/moveit2_tutorials/motion_planning_python_api_planning_scene.py", line 94, in main
[motion_planning_python_api_planning_scene.py-1] add_collision_objects(planning_scene_monitor)
[motion_planning_python_api_planning_scene.py-1] File "/home/ibrahim-hhi/ws_2/ws_ros_jazzy/ws_moveit/install/moveit2_tutorials/lib/moveit2_tutorials/motion_planning_python_api_planning_scene.py", line 54, in add_collision_objects
[motion_planning_python_api_planning_scene.py-1] with planning_scene_monitor.read_write() as scene:
[motion_planning_python_api_planning_scene.py-1] TypeError: Unable to convert function return value to a Python type! The signature was
[motion_planning_python_api_planning_scene.py-1] (self: moveit.planning.LockedPlanningSceneContextManagerRW) -> planning_scene::PlanningScene
[INFO] [ros2 run controller_manager spawner panda_hand_controller-7]: process has finished cleanly [pid 514448]
[motion_planning_python_api_planning_scene.py-1] [INFO] [1731509289.977328094] [moveit_515746186.moveit.ros.moveit_cpp]: Deleting MoveItCpp
[INFO] [ros2 run controller_manager spawner joint_state_broadcaster-8]: process has finished cleanly [pid 514449]
[motion_planning_python_api_planning_scene.py-1] [INFO] [1731509289.992207564] [moveit_515746186.moveit.ros.planning_scene_monitor]: Stopped publishing maintained planning scene.
[motion_planning_python_api_planning_scene.py-1] [INFO] [1731509289.994468726] [moveit_515746186.moveit.ros.planning_scene_monitor]: Stopping world geometry monitor
[motion_planning_python_api_planning_scene.py-1] [INFO] [1731509289.994921745] [moveit_515746186.moveit.ros.planning_scene_monitor]: Stopping planning scene monitor
[INFO] [ros2 run controller_manager spawner panda_arm_controller-6]: process has finished cleanly [pid 514447]
[ERROR] [motion_planning_python_api_planning_scene.py-1]: process has died [pid 514442, exit code 1, cmd '/home/ibrahim-hhi/ws_2/ws_ros_jazzy/ws_moveit/install/moveit2_tutorials/lib/moveit2_tutorials/motion_planning_python_api_planning_scene.py --ros-args -r __node:=moveit_py --params-file /tmp/launch_params_7y_yvm98'].

Does anyone know how to fix this problem? Thanks in advance.

System:

Ubuntu 24.04
Ros version: ros2-jazzy
Moveit Tutorial: cloned from "main" branch
Moveit2 installation: https://moveit.picknik.ai/main/doc/tutorials/getting_started/getting_started.html

@Pittmann-XIE Pittmann-XIE changed the title Error in Motion Planning Python API: plan_result = planning_component.plan() Error in Motion Planning Python API: plan_result = planning_component.plan() TypeError: plan(): incompatible function arguments. Nov 13, 2024
@Pittmann-XIE Pittmann-XIE changed the title Error in Motion Planning Python API: plan_result = planning_component.plan() TypeError: plan(): incompatible function arguments. Error in Moveit2 tutorials -- Motion Planning Python API: with planning_scene_monitor.read_write() as scene: [motion_planning_python_api_planning_scene.py-1] TypeError: Unable to convert function return value to a Python type! Nov 13, 2024
@Lydaidai
Copy link

Lydaidai commented Dec 4, 2024

Same env and same problem, is there any update? Looks like a compatibility issue with the Python API.

@Lydaidai
Copy link

Lydaidai commented Dec 4, 2024

Hi, I solved this by adding from moveit.core.planning_scene import PlanningScene.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants