Skip to content

Struggling with moveit_py, looking for a working example #376

Description

@liborw

Hello, I'm looking for an example using moveit_py, as Im strugling with passing the configuration to the moveit node.

I have lanuchfile that is basically updated hello_moveit .launch.py from the demos.

from typing import List

from launch import LaunchContext, LaunchDescription, LaunchDescriptionEntity
from launch.actions import OpaqueFunction
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from lbr_bringup.description import LBRDescriptionMixin
from lbr_bringup.moveit import LBRMoveGroupMixin


def hidden_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
    ld = LaunchDescription()

    model = LaunchConfiguration("model").perform(context)
    mode = LaunchConfiguration("mode").perform(context)
    use_sim_time = False
    if mode == "gazebo":
        use_sim_time = True

    # generate moveit configs
    moveit_configs = LBRMoveGroupMixin.moveit_configs_builder(
        robot_name=model,
        package_name=f"{model}_moveit_config",
    )

    # launch demo node
    ld.add_action(
        Node(
            package="spray_gym_ros",
            executable="hello_moveit",
            parameters=[
                moveit_configs.to_dict(),
                {"use_sim_time": use_sim_time},
                LBRDescriptionMixin.param_robot_name(),
            ],
        )
    )
    return ld.entities


def generate_launch_description() -> LaunchDescription:
    ld = LaunchDescription()

    ld.add_action(LBRDescriptionMixin.arg_model())
    ld.add_action(LBRDescriptionMixin.arg_mode())

    ld.add_action(OpaqueFunction(function=hidden_setup))

    return ld

and node that should plan some trajectories updated moveit demo from moveit2_tutorials:

#!/usr/bin/env python3
import time
import rclpy
from rclpy.logging import get_logger

from moveit.core.robot_state import RobotState
from moveit.planning import (
    MoveItPy,
    MultiPipelinePlanRequestParameters,
)

def main():

    ###################################################################
    # MoveItPy Setup
    ###################################################################
    rclpy.init()
    logger = get_logger("moveit_py.pose_goal")

    # instantiate MoveItPy instance and get planning component
    robot = MoveItPy(node_name="moveit_py")
    robot_arm = robot.get_planning_component("arm")
    logger.info("MoveItPy instance created")
...

But I get error about missing planner configurations, and the initialization of MoveItPy node, fails:

/workspace$ ros2 launch spray_gym_ros hello_moveit.launch.py     mode:=mock     model:=iiwa7
[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2026-02-18-11-11-15-825048-wagnelib-4486
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [hello_moveit-1]: process started with pid [4489]
[hello_moveit-1] [INFO] [1771413076.136491432] [moveit_60024099.moveit.py.cpp_initializer]: Initialize rclcpp
[hello_moveit-1] [INFO] [1771413076.136525525] [moveit_60024099.moveit.py.cpp_initializer]: Initialize node parameters
[hello_moveit-1] [INFO] [1771413076.136533196] [moveit_60024099.moveit.py.cpp_initializer]: Initialize node and executor
[hello_moveit-1] [INFO] [1771413076.141406627] [moveit_60024099.moveit.py.cpp_initializer]: Spin separate thread
[hello_moveit-1] [INFO] [1771413076.142982233] [moveit_60024099.moveit.ros.rdf_loader]: Loaded robot model in 0.00147871 seconds
[hello_moveit-1] [INFO] [1771413076.143006356] [moveit_60024099.moveit.core.robot_model]: Loading robot model 'iiwa7'...
[hello_moveit-1] [INFO] [1771413076.143013936] [moveit_60024099.moveit.core.robot_model]: No root/virtual joint specified in SRDF. Assuming fixed joint
[hello_moveit-1] [INFO] [1771413076.147374376] [moveit_60024099.moveit.kinematics.kdl_kinematics_plugin]: Joint weights for group 'arm': 1 1 1 1 1 1 1
[hello_moveit-1] [INFO] [1771413076.167286810] [moveit_60024099.moveit.ros.planning_scene_monitor]: Publishing maintained planning scene on 'monitored_planning_scene'
[hello_moveit-1] [INFO] [1771413076.167350782] [moveit_60024099.moveit.ros.moveit_cpp]: Listening to 'joint_states' for joint states
[hello_moveit-1] [INFO] [1771413076.167826474] [moveit_60024099.moveit.ros.current_state_monitor]: Listening to joint states on topic 'joint_states'
[hello_moveit-1] [INFO] [1771413076.168120769] [moveit_60024099.moveit.ros.planning_scene_monitor]: Listening to '/attached_collision_object' for attached collision objects
[hello_moveit-1] [INFO] [1771413076.168134199] [moveit_60024099.moveit.ros.planning_scene_monitor]: Stopping existing planning scene publisher.
[hello_moveit-1] [INFO] [1771413076.168183330] [moveit_60024099.moveit.ros.planning_scene_monitor]: Stopped publishing maintained planning scene.
[hello_moveit-1] [INFO] [1771413076.168359361] [moveit_60024099.moveit.ros.planning_scene_monitor]: Publishing maintained planning scene on 'monitored_planning_scene'
[hello_moveit-1] [INFO] [1771413076.168403357] [moveit_60024099.moveit.ros.planning_scene_monitor]: Starting planning scene monitor
[hello_moveit-1] [INFO] [1771413076.168758079] [moveit_60024099.moveit.ros.planning_scene_monitor]: Listening to '/planning_scene'
[hello_moveit-1] [INFO] [1771413076.168772947] [moveit_60024099.moveit.ros.planning_scene_monitor]: Starting world geometry update monitor for collision objects, attached objects, octomap updates.
[hello_moveit-1] [INFO] [1771413076.168986781] [moveit_60024099.moveit.ros.planning_scene_monitor]: Listening to 'collision_object'
[hello_moveit-1] [INFO] [1771413076.169207292] [moveit_60024099.moveit.ros.planning_scene_monitor]: Listening to 'planning_scene_world' for planning scene world geometry
[hello_moveit-1] [WARN] [1771413076.169298728] [moveit_60024099.moveit.ros.occupancy_map_monitor]: Resolution not specified for Octomap. Assuming resolution = 0.1 instead
[hello_moveit-1] [ERROR] [1771413076.169310715] [moveit_60024099.moveit.ros.occupancy_map_monitor]: No 3D sensor plugin(s) defined for octomap updates
[hello_moveit-1] [ERROR] [1771413076.170134890] [moveit_60024099.moveit.ros.moveit_cpp]: Failed to load any planning pipelines.
[hello_moveit-1] [FATAL] [1771413076.170154288] [moveit_60024099.moveit.ros.moveit_cpp]: Failed to load planning pipelines from parameter server
[hello_moveit-1] [INFO] [1771413076.170214686] [moveit_60024099.moveit.ros.planning_scene_monitor]: Stopped publishing maintained planning scene.
[hello_moveit-1] [INFO] [1771413076.170223095] [moveit_60024099.moveit.ros.planning_scene_monitor]: Stopping world geometry monitor
[hello_moveit-1] [INFO] [1771413076.170226028] [moveit_60024099.moveit.ros.planning_scene_monitor]: Stopping planning scene monitor
[hello_moveit-1] Traceback (most recent call last):
[hello_moveit-1]   File "/workspace/install/spray_gym_ros/lib/spray_gym_ros/hello_moveit", line 33, in <module>
[hello_moveit-1]     sys.exit(load_entry_point('spray-gym-ros', 'console_scripts', 'hello_moveit')())
[hello_moveit-1]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[hello_moveit-1]   File "/workspace/build/spray_gym_ros/spray_gym_ros/hello_moveit.py", line 30, in main
[hello_moveit-1]     robot = MoveItPy(node_name="moveit_py")
[hello_moveit-1]             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[hello_moveit-1] RuntimeError: Failed to load planning pipelines from parameter server
[ERROR] [hello_moveit-1]: process has died [pid 4489, exit code 1, cmd '/workspace/install/spray_gym_ros/lib/spray_gym_ros/hello_moveit --ros-args --params-file /tmp/launch_params_vugoqgr1 --params-file /tmp/launch_params_lluoc8qn --params-file /tmp/launch_params_bupqitrb'].

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions