Skip to content

Commit

Permalink
cherry-pick moveit#824 from kinetic-devel
Browse files Browse the repository at this point in the history
explicitly enforce updateSceneWithCurrentState() in waitForCurrentRobotState()
  • Loading branch information
rhaschke committed Apr 19, 2018
1 parent 558b66a commit 053eb7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void planning_scene_monitor::CurrentStateMonitor::stopStateMonitor()
if (state_monitor_started_)
{
joint_state_subscriber_.shutdown();
ROS_DEBUG("No longer listening o joint states");
ROS_DEBUG("No longer listening for joint states");
state_monitor_started_ = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,24 @@ bool planning_scene_monitor::PlanningSceneMonitor::waitForCurrentRobotState(cons

if (current_state_monitor_)
{
// Wait for next robot update in state monitor.
bool success = current_state_monitor_->waitForCurrentState(t, wait_time);

/* As robot updates are passed to the planning scene only in throttled fashion, there might
be still an update pending. If so, explicitly update the planning scene here.
If waitForCurrentState failed, we didn't get any new state updates within wait_time. */
if (success)
{
boost::mutex::scoped_lock lock(state_pending_mutex_);
if (state_update_pending_) // enforce state update
{
state_update_pending_ = false;
last_robot_state_update_wall_time_ = ros::WallTime::now();
lock.unlock();
updateSceneWithCurrentState();
}
return true;
}

ROS_WARN_NAMED(LOGNAME, "Failed to fetch current robot state.");
return false;
Expand Down

0 comments on commit 053eb7d

Please sign in to comment.