Skip to content

MoveGroup returns zero planning_time for successful plan-and-execute requests #4004

Backlog
VivekVRobo/moveit2
#9

Description

@Fengxiaoxx

Description

/move_action should tell the caller how long planning took in either mode. In MoveIt 2.15.3, a successful plan-and-execute request leaves result.planning_time at zero. I sent the same wrist goal twice from the same starting pose using the packaged Panda configuration, OMPL and mock hardware. Only planning_options.plan_only changed.

Request MoveIt result Planned waypoints result.planning_time (s)
Plan only (true) SUCCESS (1) 8 0.013540746
Plan and execute (false) SUCCESS (1) 8 0.0

Benchmarks and monitoring that read this action result record zero planning latency for successful plan-and-execute calls.

ROS Distro

Rolling

OS and version

Ubuntu 26.04.1 LTS (amd64, container)

Source or binary build?

Binary

If binary, which release version?

ros-rolling-moveit-ros-move-group 2.15.3-1resolute.20261124.230108, moveit_msgs 2.7.2, moveit_resources_panda_moveit_config 3.2.1. The package version in the console output was read with dpkg-query in the same container run as the A/B results.

Which RMW are you using?

FastRTPS

Steps to Reproduce

  1. Start the Panda mock-hardware demo below and wait for panda_arm_controller to become active. The starting position of panda_joint7 in the packaged configuration is 0.785 rad.
  2. Set a joint-space goal for panda_arm that moves only panda_joint7 to 0.905 rad. Send the goal to /move_action with planning_options.plan_only = true. After the result arrives, send the same goal with plan_only = false. The first request leaves the simulated robot at its starting pose.
  3. Read error_code.val, the length of planned_trajectory.joint_trajectory.points, and planning_time from each native action result.
Exact commands for the OMPL-only, headless demo and the action client

In one ROS-sourced terminal, start the Panda configuration with OMPL and mock hardware using this standalone launch file.

work="$(mktemp -d)"
cat > "$work/panda_ompl.launch.py" <<'PY'
from launch import LaunchDescription
from launch_ros.actions import Node
from moveit_configs_utils import MoveItConfigsBuilder
from moveit_configs_utils.launches import (
    generate_move_group_launch,
    generate_rsp_launch,
    generate_spawn_controllers_launch,
    generate_static_virtual_joint_tfs_launch,
)


def generate_launch_description():
    panda = (
        MoveItConfigsBuilder("moveit_resources_panda")
        .robot_description(
            file_path="config/panda.urdf.xacro",
            mappings={"ros2_control_hardware_type": "mock_components"},
        )
        .robot_description_semantic(file_path="config/panda.srdf")
        .trajectory_execution(file_path="config/moveit_controllers.yaml")
        .planning_pipelines(pipelines=["ompl"])
        .to_moveit_configs()
    )
    control = Node(
        package="controller_manager",
        executable="ros2_control_node",
        parameters=[str(panda.package_path / "config" / "ros2_controllers.yaml")],
        remappings=[("/controller_manager/robot_description", "/robot_description")],
    )
    return LaunchDescription([
        generate_rsp_launch(panda),
        generate_static_virtual_joint_tfs_launch(panda),
        control,
        generate_spawn_controllers_launch(panda),
        generate_move_group_launch(panda),
    ])
PY
ros2 launch "$work/panda_ompl.launch.py"

In a second ROS-sourced terminal, run the client.

python3 - <<'PY'
import rclpy
from moveit_msgs.action import MoveGroup
from moveit_msgs.msg import Constraints, JointConstraint
from rclpy.action import ActionClient

rclpy.init()
node = rclpy.create_node("planning_time_check")
client = ActionClient(node, MoveGroup, "/move_action")
if not client.wait_for_server(timeout_sec=30.0):
    raise RuntimeError("/move_action is unavailable")

goal = MoveGroup.Goal()
request = goal.request
request.group_name = "panda_arm"
request.pipeline_id = "ompl"
request.num_planning_attempts = 2
request.allowed_planning_time = 3.0
request.max_velocity_scaling_factor = request.max_acceleration_scaling_factor = 0.2
positions = [0.0, -0.785, 0.0, -2.356, 0.0, 1.571, 0.905]
request.goal_constraints = [Constraints(joint_constraints=[
    JointConstraint(joint_name=f"panda_joint{i}", position=q,
                    tolerance_above=0.001, tolerance_below=0.001, weight=1.0)
    for i, q in enumerate(positions, start=1)
])]

def wait(future):
    rclpy.spin_until_future_complete(node, future, timeout_sec=30.0)
    if not future.done():
        raise TimeoutError("MoveGroup request timed out")
    return future.result()

for plan_only in (True, False):
    goal.planning_options.plan_only = plan_only
    handle = wait(client.send_goal_async(goal))
    if not handle.accepted:
        raise RuntimeError("MoveGroup rejected the goal")
    wrapped = wait(handle.get_result_async())
    result = wrapped.result
    points = len(result.planned_trajectory.joint_trajectory.points)
    print(f"plan_only={plan_only} status={wrapped.status} code={result.error_code.val} "
          f"points={points} planning_time={result.planning_time}")

node.destroy_node()
rclpy.shutdown()
PY

Expected behavior

For each successful request that generates a trajectory, result.planning_time should report the time spent generating that request's motion plan. MoveGroup action definition

Actual behavior

In 2.15.3, the plan-only callback copies the planner's res.planning_time into the action result. The plan-and-execute callback fills the trajectory and error-code fields and returns with planning_time still at its default of 0.0. The same callback code is present on main at 5399d29. Plan-only callback · Plan-and-execute callback · Source on main

In a separate two-hour run, 123 saved observation files contained 87 plan-and-execute calls. One reached the client's 20 s timeout with an empty response summary. All 86 recorded action results logged planning_time as 0.0000 s at the logger's four-decimal precision. All 65 successful actions and six of the 21 aborted actions returned nonempty planned trajectories (71 in total). The A/B table above uses the unrounded native action field.

Suggested fix

One option is to add a zero-initialized double planning_time{0.0} to ExecutableMotionPlan. In planUsingPlanningPipeline(), store res.planning_time when storing the trajectory from that response. In executeMoveCallbackPlanAndExecute(), copy the stored duration to action_res->planning_time. For replanning, I suggest keeping the duration paired with the trajectory returned to the caller. A goal already satisfied before planning can keep the default 0.0. A regression test could use a planner that returns a known duration and check its propagation through both action paths. Where the planner response is stored · Replanning loop

Backtrace or Console output

ros-rolling-moveit-ros-move-group 2.15.3-1resolute.20261124.230108
plan_only=True status=4 code=1 points=8 planning_time=0.013540746
plan_only=False status=4 code=1 points=8 planning_time=0.0

Activity

  1. emreyoleridev commented on Nov 27, 2026

    @emreyoleridev

    I can see why in move_action_capability.cpp: the plan-and-execute path never copies the planning time into the result.

    • executeMoveCallbackPlanOnly does action_res->planning_time = res.planning_time;.
    • executeMoveCallbackPlanAndExecute goes through plan_execution_->planAndExecute() with opt.plan_callback → planUsingPlanningPipeline(). That function has a local MotionPlanResponse res with planning_time filled in, but it only copies res.trajectory and res.error_code into the ExecutableMotionPlan, and res goes out of scope there. ExecutableMotionPlan has no field for it, so when the callback fills in action_res (trajectory, executed trajectory, error code), planning_time stays at its default 0.0.

    A fix would carry res.planning_time out of planUsingPlanningPipeline (a member on the capability, or a field on ExecutableMotionPlan) and assign it in executeMoveCallbackPlanAndExecute. With replan: true the callback can run several times, so it should probably add up the time across attempts instead of keeping only the last one.

    Until that's fixed, for benchmarks you can send plan_only = true to /move_action and then execute the returned trajectory through /execute_trajectory. That gives you the real planning_time and the same execution path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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