Skip to content

PythonAPI help: planning pipeline #1056

@burf2000

Description

@burf2000

Hello there, I have been trying to get to grips with the Python API.

I use a launch file to pass all the params, and I can see they are being loaded. However the issue I face is with the planning pipeline. I have spent days trying to work out what its expecting: See log below.

I have been using pipelines (like ompl, stomp, chomp) that come with whatever repo I use (e.g myCobot, Igus_rebel). I fire up their MoveIt2 demo (Gazebo, MoveIt, Rvzi, everything is ready to go) however when I make my own package (the Python API to control the arm), it can never seem to load the other persons existing planning file.

I have tried ones like:

planning_pipelines:
  pipeline_names: ["ompl"]

plan_request_params:
  planning_pipeline: ompl
  planning_time: 5.0
  planning_attempts: 3
  max_velocity_scaling_factor: 0.5
  max_acceleration_scaling_factor: 0.5

request_adapters:
  - default_planning_request_adapters/ResolveConstraintFrames
  - default_planning_request_adapters/ValidateWorkspaceBounds
  - default_planning_request_adapters/CheckStartStateBounds
  - default_planning_request_adapters/CheckStartStateCollision

planner_configs:
  # Global planner configurations
  RRTConnectkConfigDefault:
    type: geometric::RRTConnect
    range: 0.0

igus_rebel_arm:
  default_planner_config: RRTConnectkConfigDefault
  planner_configs:
    - RRTConnectkConfigDefault

Or ones like that came with the Arm:

move_group:
  planning_plugins: 
    - ompl_interface/OMPLPlanner
  # To optionally use Ruckig for jerk-limited smoothing, add this line to the request adapters below
  # default_planner_request_adapters/AddRuckigTrajectorySmoothing
  request_adapters:
    - default_planning_request_adapters/ResolveConstraintFrames
    - default_planning_request_adapters/ValidateWorkspaceBounds
    - default_planning_request_adapters/CheckStartStateBounds
    - default_planning_request_adapters/CheckStartStateCollision
  response_adapters:
    - default_planning_response_adapters/AddTimeOptimalParameterization
    - default_planning_response_adapters/ValidateSolution
    - default_planning_response_adapters/DisplayMotionPath
  start_state_max_bounds_error: 0.1
  
planner_configs:
  APSConfigDefault:
    type: geometric::AnytimePathShortening
    shortcut: 1  # Attempt to shortcut all new solution paths
    hybridize: 1  # Compute hybrid solution trajectories
    max_hybrid_paths: 36  # Number of hybrid paths generated per iteration
    num_planners: 8  # The number of default planners to use for planning
    planners: "RRTConnect,RRTConnect,RRTConnect,RRTConnect,RRTConnect,RRTConnect,RRTConnect,RRTConnect"  # A comma-separated list of planner types (e.g., "PRM,EST,RRTConnect"Optionally, planner parameters can be passed to change the default:"PRM[max_nearest_neighbors=5],EST[goal_bias=.5],RRT[range=10. goal_bias=.1]"
  SBLkConfigDefault:
    type: geometric::SBL
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
  ESTkConfigDefault:
    type: geometric::EST
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0 setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
  LBKPIECEkConfigDefault:
    type: geometric::LBKPIECE
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9
    min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5
  BKPIECEkConfigDefault:
    type: geometric::BKPIECE
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9
    failed_expansion_score_factor: 0.5  # When extending motion fails, scale score by factor. default: 0.5
    min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5
  KPIECEkConfigDefault:
    type: geometric::KPIECE
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
    border_fraction: 0.9  # Fraction of time focused on boarder default: 0.9 (0.0,1.]
    failed_expansion_score_factor: 0.5  # When extending motion fails, scale score by factor. default: 0.5
    min_valid_path_fraction: 0.5  # Accept partially valid moves above fraction. default: 0.5
  RRTkConfigDefault:
    type: geometric::RRT
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05
  RRTConnectkConfigDefault:
    type: geometric::RRTConnect
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
  RRTstarkConfigDefault:
    type: geometric::RRTstar
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05
    delay_collision_checking: 1  # Stop collision checking as soon as C-free parent found. default 1
  TRRTkConfigDefault:
    type: geometric::TRRT
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability? default: 0.05
    max_states_failed: 10  # when to start increasing temp. default: 10
    temp_change_factor: 2.0  # how much to increase or decrease temp. default: 2.0
    min_temperature: 10e-10  # lower limit of temp change. default: 10e-10
    init_temperature: 10e-6  # initial temperature. default: 10e-6
    frountier_threshold: 0.0  # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()
    frountierNodeRatio: 0.1  # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1
    k_constant: 0.0  # value used to normalize expression. default: 0.0 set in setup()
  PRMkConfigDefault:
    type: geometric::PRM
    max_nearest_neighbors: 10  # use k nearest neighbors. default: 10
  PRMstarkConfigDefault:
    type: geometric::PRMstar
  FMTkConfigDefault:
    type: geometric::FMT
    num_samples: 1000  # number of states that the planner should sample. default: 1000
    radius_multiplier: 1.1  # multiplier used for the nearest neighbors search radius. default: 1.1
    nearest_k: 1  # use Knearest strategy. default: 1
    cache_cc: 1  # use collision checking cache. default: 1
    heuristics: 0  # activate cost to go heuristics. default: 0
    extended_fmt: 1  # activate the extended FMT*: adding new samples if planner does not finish successfully. default: 1
  BFMTkConfigDefault:
    type: geometric::BFMT
    num_samples: 1000  # number of states that the planner should sample. default: 1000
    radius_multiplier: 1.0  # multiplier used for the nearest neighbors search radius. default: 1.0
    nearest_k: 1  # use the Knearest strategy. default: 1
    balanced: 0  # exploration strategy: balanced true expands one tree every iteration. False will select the tree with lowest maximum cost to go. default: 1
    optimality: 1  # termination strategy: optimality true finishes when the best possible path is found. Otherwise, the algorithm will finish when the first feasible path is found. default: 1
    heuristics: 1  # activates cost to go heuristics. default: 1
    cache_cc: 1  # use the collision checking cache. default: 1
    extended_fmt: 1  # Activates the extended FMT*: adding new samples if planner does not finish successfully. default: 1
  PDSTkConfigDefault:
    type: geometric::PDST
  STRIDEkConfigDefault:
    type: geometric::STRIDE
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
    use_projected_distance: 0  # whether nearest neighbors are computed based on distances in a projection of the state rather distances in the state space itself. default: 0
    degree: 16  # desired degree of a node in the Geometric Near-neightbor Access Tree (GNAT). default: 16
    max_degree: 18  # max degree of a node in the GNAT. default: 12
    min_degree: 12  # min degree of a node in the GNAT. default: 12
    max_pts_per_leaf: 6  # max points per leaf in the GNAT. default: 6
    estimated_dimension: 0.0  # estimated dimension of the free space. default: 0.0
    min_valid_path_fraction: 0.2  # Accept partially valid moves above fraction. default: 0.2
  BiTRRTkConfigDefault:
    type: geometric::BiTRRT
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    temp_change_factor: 0.1  # how much to increase or decrease temp. default: 0.1
    init_temperature: 100  # initial temperature. default: 100
    frountier_threshold: 0.0  # dist new state to nearest neighbor to disqualify as frontier. default: 0.0 set in setup()
    frountier_node_ratio: 0.1  # 1/10, or 1 nonfrontier for every 10 frontier. default: 0.1
    cost_threshold: 1e300  # the cost threshold. Any motion cost that is not better will not be expanded. default: inf
  LBTRRTkConfigDefault:
    type: geometric::LBTRRT
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
    epsilon: 0.4  # optimality approximation factor. default: 0.4
  BiESTkConfigDefault:
    type: geometric::BiEST
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
  ProjESTkConfigDefault:
    type: geometric::ProjEST
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
    goal_bias: 0.05  # When close to goal select goal, with this probability. default: 0.05
  LazyPRMkConfigDefault:
    type: geometric::LazyPRM
    range: 0.0  # Max motion added to tree. ==> maxDistance_ default: 0.0, if 0.0, set on setup()
  LazyPRMstarkConfigDefault:
    type: geometric::LazyPRMstar
  SPARSkConfigDefault:
    type: geometric::SPARS
    stretch_factor: 3.0  # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0
    sparse_delta_fraction: 0.25  # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25
    dense_delta_fraction: 0.001  # delta fraction for interface detection. default: 0.001
    max_failures: 1000  # maximum consecutive failure limit. default: 1000
  SPARStwokConfigDefault:
    type: geometric::SPARStwo
    stretch_factor: 3.0  # roadmap spanner stretch factor. multiplicative upper bound on path quality. It does not make sense to make this parameter more than 3. default: 3.0
    sparse_delta_fraction: 0.25  # delta fraction for connection distance. This value represents the visibility range of sparse samples. default: 0.25
    dense_delta_fraction: 0.001  # delta fraction for interface detection. default: 0.001
    max_failures: 5000  # maximum consecutive failure limit. default: 5000
  TrajOptDefault:
    type: geometric::TrajOpt

igus_rebel_arm:
  planner_configs:
    - APSConfigDefault
    - SBLkConfigDefault
    - ESTkConfigDefault
    - LBKPIECEkConfigDefault
    - BKPIECEkConfigDefault
    - KPIECEkConfigDefault
    - RRTkConfigDefault
    - RRTConnectkConfigDefault
    - RRTstarkConfigDefault
    - TRRTkConfigDefault
    - PRMkConfigDefault
    - PRMstarkConfigDefault
    - FMTkConfigDefault
    - BFMTkConfigDefault
    - PDSTkConfigDefault
    - STRIDEkConfigDefault
    - BiTRRTkConfigDefault
    - LBTRRTkConfigDefault
    - BiESTkConfigDefault
    - ProjESTkConfigDefault
    - LazyPRMkConfigDefault
    - LazyPRMstarkConfigDefault
    - SPARSkConfigDefault
    - SPARStwokConfigDefault
    - TrajOptDefault

My launch file looks like this: (remember the Rviz, Gazebo etc has been fired up with another launch)

import os
from launch import LaunchDescription
from launch_ros.actions import Node
from moveit_configs_utils import MoveItConfigsBuilder
from ament_index_python.packages import get_package_share_directory

def generate_launch_description():

    moveit_config = (
        MoveItConfigsBuilder("igus_rebel", package_name="igus_rebel_moveit_config")
        .robot_description(file_path=os.path.join(
            get_package_share_directory("igus_rebel_description"),
            "urdf",
            "igus_rebel_robot2.urdf.xacro"
        ))
        .robot_description_semantic(file_path="config/igus_rebel2.srdf")
        # .planning_pipelines(pipelines=["ompl"])
        .joint_limits(file_path="config/joint_limits.yaml")
        .pilz_cartesian_limits(file_path="config/pilz_cartesian_limits.yaml")
        .trajectory_execution(file_path="config/moveit_controllers.yaml")
        .moveit_cpp(
            file_path=get_package_share_directory("igus_rebel_moveit_config")
            + "/config/planning_python_api.yaml"
        )
        .to_moveit_configs()
    )


    api_server = Node(
        name="moveit_py",
        package="igus_rebel_api",
        executable="moveit_http_server",
        output="both",
        parameters=[moveit_config.to_dict(), {"use_sim_time": True}]
    )

    return LaunchDescription([
        api_server
    ])
[INFO] [moveit_http_server-1]: process started with pid [635177]
[moveit_http_server-1] [INFO] [1752735207.805195173] [moveit_1703450355.moveit.py.cpp_initializer]: Initialize rclcpp
[moveit_http_server-1] [INFO] [1752735207.805262563] [moveit_1703450355.moveit.py.cpp_initializer]: Initialize node parameters
[moveit_http_server-1] [INFO] [1752735207.805275729] [moveit_1703450355.moveit.py.cpp_initializer]: Initialize node and executor
[moveit_http_server-1] [INFO] [1752735207.813505769] [moveit_1703450355.moveit.py.cpp_initializer]: Spin separate thread
[moveit_http_server-1] [INFO] [1752735207.818829265] [moveit_1703450355.moveit.ros.rdf_loader]: Loaded robot model in 0 seconds
[moveit_http_server-1] [INFO] [1752735207.818889406] [moveit_1703450355.moveit.core.robot_model]: Loading robot model 'igus_rebel'...
[moveit_http_server-1] [INFO] [1752735208.129960668] [moveit_1703450355.moveit.kinematics.kdl_kinematics_plugin]: Joint weights for group 'igus_rebel_arm': 1 1 1 1 1 1
[moveit_http_server-1] [INFO] [1752735209.394457649] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Publishing maintained planning scene on 'monitored_planning_scene'
[moveit_http_server-1] [INFO] [1752735209.394611438] [moveit_1703450355.moveit.ros.moveit_cpp]: Listening to 'joint_states' for joint states
[moveit_http_server-1] [INFO] [1752735209.395510990] [moveit_1703450355.moveit.ros.current_state_monitor]: Listening to joint states on topic 'joint_states'
[moveit_http_server-1] [INFO] [1752735209.395905215] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Listening to '/attached_collision_object' for attached collision objects
[moveit_http_server-1] [INFO] [1752735209.395922598] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Stopping existing planning scene publisher.
[moveit_http_server-1] [INFO] [1752735209.396039933] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Stopped publishing maintained planning scene.
[moveit_http_server-1] [INFO] [1752735209.396369562] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Publishing maintained planning scene on 'monitored_planning_scene'
[moveit_http_server-1] [INFO] [1752735209.396443733] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Starting planning scene monitor
[moveit_http_server-1] [INFO] [1752735209.396736566] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Listening to '/planning_scene'
[moveit_http_server-1] [INFO] [1752735209.396749754] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Starting world geometry update monitor for collision objects, attached objects, octomap updates.
[moveit_http_server-1] [INFO] [1752735209.397964327] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Listening to 'collision_object'
[moveit_http_server-1] [INFO] [1752735209.398418423] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Listening to 'planning_scene_world' for planning scene world geometry
[moveit_http_server-1] [WARN] [1752735209.398673556] [moveit_1703450355.moveit.ros.occupancy_map_monitor]: Resolution not specified for Octomap. Assuming resolution = 0.1 instead
[moveit_http_server-1] [ERROR] [1752735209.398690920] [moveit_1703450355.moveit.ros.occupancy_map_monitor]: No 3D sensor plugin(s) defined for octomap updates
[moveit_http_server-1] [INFO] [1752735211.089264311] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Stopped publishing maintained planning scene.
[moveit_http_server-1] [INFO] [1752735211.089293881] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Stopping world geometry monitor
[moveit_http_server-1] [INFO] [1752735211.089300257] [moveit_1703450355.moveit.ros.planning_scene_monitor]: Stopping planning scene monitor
[moveit_http_server-1] Traceback (most recent call last):
[moveit_http_server-1]   File "/home/burf2000/igus_ws/install/igus_rebel_api/lib/igus_rebel_api/moveit_http_server", line 33, in <module>
[moveit_http_server-1]     sys.exit(load_entry_point('igus-rebel-api==0.0.0', 'console_scripts', 'moveit_http_server')())
[moveit_http_server-1]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[moveit_http_server-1]   File "/home/burf2000/igus_ws/install/igus_rebel_api/lib/python3.12/site-packages/igus_rebel_api/moveit_http_server.py", line 114, in main
[moveit_http_server-1]     moveit = MoveItPy(node_name="moveit_http_server")   # loads MoveIt params
[moveit_http_server-1]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[moveit_http_server-1] RuntimeError: Planning plugin name is empty or not defined in namespace 'ompl'. Please choose one of the available plugins: chomp_interface/CHOMPPlanner, ompl_interface/OMPLPlanner, pilz_industrial_motion_planner/CommandPlanner, stomp_moveit/StompPlanner
[ERROR] [moveit_http_server-1]: process has died [pid 635177, exit code 1, cmd '/home/burf2000/igus_ws/install/igus_rebel_api/lib/igus_rebel_api/moveit_http_server --ros-args -r __node:=moveit_py --params-file /tmp/launch_params_0e2ifwxp --params-file /tmp/launch_params_zymaz5v1'].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions