Skip to content

Commit

Permalink
Simplify scene update that does not include new robot_state (#3206)
Browse files Browse the repository at this point in the history
* Simplify scene update that does not include new robot_state

* Further simplify condition

---------

Co-authored-by: Robert Haschke <rhaschke@users.noreply.github.com>
  • Loading branch information
MarqRazz and rhaschke authored Jan 7, 2025
1 parent 80c7f61 commit 75286c7
Showing 1 changed file with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -740,21 +740,9 @@ 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());
}
}
// If there is no new robot_state, transfer RobotState from current scene to parent scene
if (scene.robot_state.is_diff)
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

0 comments on commit 75286c7

Please sign in to comment.