Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix planning_scene_monitor sync when passed empty robot state (backport #3187) #3204

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,21 @@ bool PlanningSceneMonitor::newPlanningSceneMessage(const moveit_msgs::msg::Plann

if (!scene.is_diff && parent_scene_)
{
// if the scene does not contain a robot state then use the latest known values for the robot state
// so that we are not updating the scene with stale values.
if (scene.robot_state.joint_state.name.empty())
{
// if we have a valid current_state_monitor_ with complete state use the latest data otherwise try
// to use the maintained (diff) scene_ which may fall back to the parent_scene_ data and not update.
if (current_state_monitor_ && current_state_monitor_->haveCompleteState())
{
parent_scene_->setCurrentState(*current_state_monitor_->getCurrentState());
}
else
{
parent_scene_->setCurrentState(scene_->getCurrentState());
}
}
// clear maintained (diff) scene_ and set the full new scene in parent_scene_ instead
scene_->clearDiffs();
result = parent_scene_->setPlanningSceneMsg(scene);
Expand Down
Loading