Skip to content

Check rclcpp::ok before sleeping for clean shutdown (backport #3484)#3485

Merged
MarqRazz merged 2 commits intohumblefrom
mergify/bp/humble/pr-3484
May 29, 2025
Merged

Check rclcpp::ok before sleeping for clean shutdown (backport #3484)#3485
MarqRazz merged 2 commits intohumblefrom
mergify/bp/humble/pr-3484

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify bot commented May 28, 2025

Description

In MTC PR#684 I found move_group fails to shut down cleanly when preempting motion. This is because we are asking the node to sleep when the stack has been requested to shut down. To fix this I added a simple guard to make sure rclcpp::ok() before sleeping.

Here is a snippet of the stack trace when shutting down.

[move_group-5] #10   Source "/root/my_ws/src/moveit2/moveit_ros/planning/planning_scene_monitor/src/planning_scene_monitor.cpp", line 549, in scenePublishingThread [0x7d8db9c1afaf]
[move_group-5]         546:       planning_scene_publisher_->publish(msg);
[move_group-5]         547:       if (is_full)
[move_group-5]         548:         RCLCPP_DEBUG(logger_, "Published full planning scene: '%s'", msg.name.c_str());
[move_group-5]       > 549:       rate.sleep();
[move_group-5]         550:     }
[move_group-5] #9    Object "/opt/ros/jazzy/lib/librclcpp.so", at 0x7d8db914c480, in rclcpp::Rate::sleep()
[move_group-5] #8    Object "/opt/ros/jazzy/lib/librclcpp.so", at 0x7d8db90a0238, in rclcpp::Clock::sleep_for(rclcpp::Duration, std::shared_ptr<rclcpp::Context>)

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

This is an automatic backport of pull request #3484 done by [Mergify](https://mergify.com).

Calling rate.sleep() on shutdown will crash

(cherry picked from commit f4cf780)

# Conflicts:
#	moveit_ros/planning/planning_scene_monitor/src/planning_scene_monitor.cpp
@mergify
Copy link
Copy Markdown
Author

mergify bot commented May 28, 2025

Cherry-pick of f4cf780 has failed:

On branch mergify/bp/humble/pr-3484
Your branch is up to date with 'origin/humble'.

You are currently cherry-picking commit f4cf780f8.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   moveit_ros/planning/planning_scene_monitor/src/planning_scene_monitor.cpp

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@codecov
Copy link
Copy Markdown

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 50.95%. Comparing base (a60ed9f) to head (4d67b88).
Report is 1 commits behind head on humble.

Additional details and impacted files
@@            Coverage Diff             @@
##           humble    #3485      +/-   ##
==========================================
- Coverage   50.96%   50.95%   -0.00%     
==========================================
  Files         390      390              
  Lines       32520    32521       +1     
==========================================
- Hits        16569    16568       -1     
- Misses      15951    15953       +2     

☔ 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.

Copy link
Copy Markdown
Contributor

@MarqRazz MarqRazz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up @rhaschke!

@MarqRazz MarqRazz merged commit 3f2d7f5 into humble May 29, 2025
8 checks passed
@MarqRazz MarqRazz deleted the mergify/bp/humble/pr-3484 branch May 29, 2025 14:22
@github-project-automation github-project-automation bot moved this to ✅ Done in MoveIt May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants