Moveit2: Execution of a planned trajectory fails (Rviz MotionPlanning Plugin)

asked 2023-04-21 07:21:14 -0500

robin_rob96 gravatar image

Hi there, I'm trying to get my first own robot project working with ros2 (humble).

I've created a simple URDF file with 6 revolute joints, so its only for purpose for me to understand how moveit etc. works - there is no real robot atm that I want to control. I also created a moveit-config package with the Setup Assistant. Before I test this tutorial I wanted to test whether the moveit_config pkg etc works. Turns out, I can plan (MotionPlanning in RViz), but when I click "execute" in RViz, it only says 'failed'.

I assume the problem being me not understanding the correct architecture to get it working; so feel free to correct my assumptions:

  • For using MoveIt2 we need a config package; created with the setup assistant
  • Important parts are 'moveit_controllers.yaml' and 'ros2_controllers.yaml' in /config. The first tells moveit what to control really. The second for me seems to be more on the hardware-side, like for the actual hardware commands. Do I need them in a simulation-only setup? I think I still load 'controllers' that are imitating real hardware-controllers and publishes the joint states like a real hardware controller would?!

Based on the Log output, I assume it has something to do with the controller manager but I cannot figure it out unfortunately :( Here are important pieces of my launch file:

    move_group_node = Node(
    package="moveit_ros_move_group",
    executable="move_group",
    output="screen",
    arguments = ['--ros-args', '--log-level', 'WARN'],
    parameters=[
        robot_description,
        robot_description_semantic,
    ],
)

# Load controllers
controllers_path = os.path.join(
    get_package_share_directory(MOVEIT_CONFIG_PKG),
    "config",
    MOVEIT_CONTROLLERS_FILE_NAME,
)
control_node = Node(
    package="controller_manager",
    executable="ros2_control_node",
    parameters=[robot_description, controllers_path],
    output="log",
    arguments = ['--ros-args', '--log-level', 'WARN']
)


# launch controllers
load_controllers = []
for controller in [
    "robot_arm_controller",
    "joint_state_broadcaster",
]:
    load_controllers += [
        ExecuteProcess(
            cmd=["ros2 run controller_manager spawner  {}".format(
                controller)],
            shell=True,
            output="screen",
        )
    ]

And:

 # RViz
rviz_config_file = (
    os.path.join(get_package_share_directory(DESCRIPTION_PKG), "rviz", RVIZ_FILE_NAME)
)


rviz_node = Node(
    package="rviz2",
    executable="rviz2",
    output="log",
    arguments=["-d", rviz_config_file,'--ros-args', '--log-level', 'WARN'],
    parameters=[
        robot_description,
        robot_description_semantic,
    ],
)

# Static TF
static_tf = Node(
    package="tf2_ros",
    executable="static_transform_publisher",
    name="static_transform_publisher",
    output="log",
    arguments=["0.0", "0.0", "0.0", "0.0",
               "0.0", "0.0", "world", "link0"],
)

# Publish TF
robot_state_publisher = Node(
    package="robot_state_publisher",
    executable="robot_state_publisher",
    name="robot_state_publisher",
    output="log",
    parameters=[robot_description],
)

joint_state_pub = Node(
    package="joint_state_publisher",
    executable="joint_state_publisher",
    name="joint_state_publisher",
    condition=UnlessCondition(LaunchConfiguration(JOINT_GUI)),
)

joint_state_pub_gui = Node(
    package="joint_state_publisher_gui",
    executable="joint_state_publisher_gui",
    name="joint_state_publisher_gui",
    condition=IfCondition(LaunchConfiguration(JOINT_GUI)),
)

return LaunchDescription(
    declared_arguments +
    [   
    control_node,
    move_group_node,
    rviz_node,
    static_tf,
    robot_state_publisher,
    joint_state_pub,
    joint_state_pub_gui,
    ]
    + load_controllers
)

And here a part of the log; It even says that I can plan (And in rviz it looks like it got a plan; it states the time it needed for planning, like 0.01sec).

[move_group-2] You can start planning now!
[move_group-2] 
[joint_state_publisher-6] [INFO] [1682078430.667513934] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic...
[rviz2-3] Warning: class_loader.impl: SEVERE WARNING!!! A namespace collision has occurred with plugin factory for class rviz_default_plugins::displays::InteractiveMarkerDisplay. New factory will OVERWRITE existing one. This situation occurs when libraries containing plugins are directly linked against an executable (the one running right now generating this message). Please separate plugins out into their own ...
(more)
edit retag flag offensive close merge delete