MoveIt Pro Core Python Bindings
MoveIt Pro provides Python bindings to its core algorithms, including advanced inverse kinematics solvers, motion planners, and kinematic utilities. These bindings enable Python developers to leverage MoveIt Pro's high-performance C++ implementations directly from Python, making it easy to integrate sophisticated motion planning capabilities into Python applications and workflows.
This document introduces the MoveIt Pro Python bindings (moveit_pro_py) with practical examples and code snippets to help you get started quickly.
Overview
moveit_pro_py provides a Python interface to MoveIt Pro's advanced motion planning capabilities, including:
- Inverse Kinematics (IK): Single pose and path IK with configurable solvers
- Cartesian Planning: Path planning with Cartesian constraints
- RRT Planning: ProRRT planner for collision-free joint-space trajectories
- Jacobian Computation: Single and multi-tip Jacobians for velocity control
- Planning Scene: Robot state and collision environment management
- Trajectory Generation: Convert waypoints to executable trajectories
Quick Start
Setup your license key
Before using MoveIt Pro Python bindings, ensure that you have a valid license key set up. The license validation is handled automatically when you try to use any protected functionality. The license number should be set in the MOVEIT_LICENSE_KEY environment variable, e.g.:
Loading a Robot Model from Files
The examples below use the upstream MoveIt Panda test fixture, which the MoveIt Pro Runtime image does not install. Either point the urdf_path and srdf_path in each example at your own robot, or install the fixture. Note that moveit-resources-panda-moveit-config apt-depends on joint_state_publisher_gui, which pulls in the GPL-3.0 PyQt5 bindings. To install it:
Load a robot model directly from URDF and SRDF files without ROS parameters (complete example):
See examples/plan_joint_space.py in the installed moveit_pro_py package for a complete example.
Planning Scene Monitor with URDF/SRDF Strings
Create a Planning Scene Monitor without ROS parameters, using URDF/SRDF strings directly:
See examples/start_psm.py in the installed moveit_pro_py package for a complete example.
Planning Scene Monitor with ROS Parameters
Traditional approach using ROS parameters:
Core Modules
The examples below include only code snippets and are not full examples. See the examples under moveit_pro_py/demo/ for complete scripts.
moveit_pro.kinematics
Inverse kinematics and kinematic queries.
Single Pose IK
Solve IK for a single end-effector pose:
IK with Custom Parameters
IK with Per-Joint Costs
On a redundant group, bias the solver away from specific joints. Costs apply one per active joint in the group's joint order: 1.0 is the unbiased baseline, higher values make it more expensive for the solution to move that joint away from the seed (50.0 is the accepted maximum), and an empty list applies no bias. Costs below 1.0 are an error: to make a joint comparatively cheap, raise the costs of the other joints instead. Costs require solve_mode = OPTIMIZE_DISTANCE and a finite and strictly positive optimization_distance_gain. Displacement is measured in each joint's own units, radians for revolute and meters for prismatic, so equal costs on a mixed group are not physically equal penalties.
Multi-Target IK
Solve IK for multiple end effectors simultaneously:
moveit_pro.kinematics.path_ik
Cartesian path planning and Jacobian computation.
Cartesian Path IK
Compute joint-space path that follows a Cartesian trajectory:
Path IK with Options
Multi-Tip Cartesian Planning
Plan coordinated motion for multiple end effectors:
Jacobian Computation
Compute Jacobian for velocity control:
Velocity Inverse Kinematics
Convert Cartesian velocities to joint velocities:
moveit_pro.planning
Motion planning and trajectory generation.
Planning Scene
Access robot state and collision environment:
Collision Padding
Pad the collision geometry of robot links, world objects, or attached bodies on the scene itself, in meters. The direct planning functions (pro_rrt.plan_path_to_joint_goal, pro_rrt.plan_trajectory_to_joint_goal) and scene.check_collision honor the scene's padding. The MTC ProRRTPlanner replaces link and world padding with its own settings at plan time; attached body padding stays in effect everywhere. Self-collision checks run unpadded in scene.check_collision, while pro_rrt planning pads them unless RRTParams.pad_self_collisions is set to False.
World and attached body padding live on the scene object only: they are not part of moveit_msgs/PlanningScene and do not survive a message round-trip. Per-object and per-body entries are kept until cleared, even after the object leaves the scene, and a later object under the same id uses them.
ProRRT Planner
Plan collision-free trajectories in joint space:
ProRRT with Custom Parameters
The MTC ProRRTPlanner exposes the same knobs through setters: set_max_iterations, set_configuration_space_step, set_seed, set_seed_attempts, set_optimization_iterations, and set_pad_self_collisions. The timeout comes from the MTC stage instead of the planner.
The step is the largest gap, in joint space, between two configurations the search collision-checks. Raising it lets thin geometry pass between checks unnoticed, and nothing re-checks the result unless the planner was constructed with validate_trajectory=True. Keep step * r (with r the distance of the farthest collision body from the moving joint axes) below the collision padding, and raise link_padding / world_padding alongside any increase in the step.
ProRRT with Constraints
Create Trajectory from Waypoints
Convert joint-space waypoints to a time-parameterized trajectory:
Blend Joint Trajectories
Blend a sequence of pre-planned joint trajectories into a single smooth trajectory, eliminating full stops between consecutive motions:
Complete Examples
Full example scripts are available in the examples/ directory of the installed moveit_pro_py package (typically located at <install_prefix>/share/moveit_pro_py/examples/):
- examples/plan_joint_space.py - Joint-space planning with ProRRT
- examples/plan_cartesian_space.py - Cartesian path planning with path_ik
- examples/compute_ik.py - Single pose inverse kinematics with solve_ik
- examples/compute_ik_joint_costs.py - Biasing IK solutions away from specific joints with per-joint costs
- examples/start_psm.py - PlanningSceneMonitor with URDF/SRDF strings
- examples/plan_joint_space_mtc.py - MTC joint-space planning with ProRRTPlanner
- examples/plan_cartesian_space_mtc.py - MTC Cartesian planning with PathIK stage
Error Handling
API Reference
Classes
- kinematics.PoseTarget: Target pose for IK solver
- kinematics.IKParams: Parameters for IK solver
- kinematics.IKSolveMode: Enum for IK solving strategies
- path_ik.PathIKOptions: Options for Cartesian path IK
- path_ik.PathIKOptions.TipConstraint: Enum for constraint types
- path_ik.PartialPathError: Exception with partial path data
- pro_rrt.RRTParams: Parameters for RRT planner
- pro_rrt.TrajectoryParams: Parameters for trajectory generation
- pro_rrt.Constraints: Path constraints for planning
- pro_rrt.PlanningErrorException: Planning failure exception
- planning.JointLimits: Per-joint kinematic limits for trajectory blending
- tasks.ProRRTPlanner: MTC joint-space planner with link_padding and world_padding collision margins (padding is deprecated in favor of link_padding)
- PlanningScene: Robot state and collision environment, with collision padding methods for links (set_link_padding, set_link_scale), world objects (set_world_padding, set_world_object_padding), and attached bodies (set_attached_body_padding)
- PlanningSceneMonitor: Thread-safe planning scene access
Functions
Kinematics
- kinematics.solve_ik(): Solve inverse kinematics
- path_ik.path_ik(): Cartesian path inverse kinematics
- path_ik.compute_jacobian_for_chain(): Single-tip Jacobian
- path_ik.compute_multi_tip_jacobian(): Multi-tip Jacobian
- path_ik.velocity_inverse_kinematics(): Velocity IK
Planning
- pro_rrt.plan_trajectory_to_joint_goal(): Plan joint-space trajectory
- blend_joint_trajectories(): Blend a sequence of joint trajectories with smooth transitions
- create_trajectory_message_from_waypoints(): Create trajectory message
Best Practices
- Always initialize both rclpy and rclcpp: Required for proper ROS communication
- Use context managers with PlanningSceneMonitor: Ensures thread-safe access
- Update robot state before queries: Call state.update() after modifications
- Provide validation functions: Prevent invalid IK solutions (collisions, limits)
- Handle partial paths gracefully: Cartesian planning may find partial solutions
- Set reasonable timeouts: Prevent indefinite waiting in IK/planning
- Configure kinematic limits: Set velocity/acceleration bounds before planning
- Use appropriate scaling factors: Control speed of generated trajectories
Troubleshooting
Problem: IK always fails
- Check that target pose is reachable
- Increase timeout
- Verify robot state is updated
- Ensure validation function isn't too restrictive
Problem: Cartesian path fails
- Try smaller steps between waypoints
- Adjust path IK options (blending, constraints)
- Use position-only constraints for more flexibility
- Check joint limits and singularities
Problem: Planning fails with collisions
- Verify collision objects in planning scene
- Check self-collision settings
- Increase configuration space step for RRT
- Add clearance to obstacles
Problem: State updates don't reflect
- Must call state.update() after modifications
- Ensure using read_write context for modifications
- Check that monitor is receiving state updates
License
Copyright 2025 PickNik Inc. All rights reserved. Proprietary and confidential.
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.