Skip to content

Fix RViz Cartesian execute crash under sim-time mismatch#3722

Open
chdkf wants to merge 1 commit into
moveit:humblefrom
chdkf:fix/cartesian-execute-sigsegv-sim-time
Open

Fix RViz Cartesian execute crash under sim-time mismatch#3722
chdkf wants to merge 1 commit into
moveit:humblefrom
chdkf:fix/cartesian-execute-sigsegv-sim-time

Conversation

@chdkf
Copy link
Copy Markdown

@chdkf chdkf commented May 15, 2026

Fix null pointer dereference in computeCartesianPlan() under sim_time

Problem

In simulation setups where /joint_states carries sim_time stamps and
RViz uses wall time, move_group_->getCurrentState() always times out and
returns nullptr (wall time ~1.78×10⁹ s vs sim time ~tens of seconds, so
the 1-second wait in waitForCurrentState(node->now(), 1s) never succeeds).
Dereferencing the returned pointer crashes the RViz process with SIGSEGV.

Fix

Replace the blocking call with the PlanningSceneMonitor's already-tracked
state, consistent with all five other current-state accesses in this file:

-rt.setRobotTrajectoryMsg(*move_group_->getCurrentState(), trajectory);
+rt.setRobotTrajectoryMsg(planning_display_->getPlanningSceneRO()->getCurrentState(), trajectory);

Why this is correct

  • PlanningSceneMonitor maintains the current robot state continuously and does not block on timestamp matching.
  • Every other call site in motion_planning_frame_planning.cpp already uses getPlanningSceneRO()->getCurrentState().
    This was the only exception.
  • Behavior is identical in non-sim setups.

Reproduction

  1. Launch MoveIt with Gazebo + ros2_control (use_sim_time=true), RViz with use_sim_time=false (default).
  2. Compute a Cartesian path in the MotionPlanning panel.
  3. Click Execute → RViz crashes with SIGSEGV before this patch.

@mergify
Copy link
Copy Markdown

mergify Bot commented May 15, 2026

Please target the main branch for development, we will backport the changes to humble for you if approved and if they don't break API.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.20%. Comparing base (e7004f4) to head (632d08b).

Additional details and impacted files
@@            Coverage Diff             @@
##           humble    #3722      +/-   ##
==========================================
- Coverage   51.21%   51.20%   -0.00%     
==========================================
  Files         407      407              
  Lines       30667    30667              
==========================================
- Hits        15704    15701       -3     
- Misses      14963    14966       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant