ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

stopping malfunctioning sensor from cluttering the costmap

asked 2012-03-02 09:11:46 -0500

fwh gravatar image

I'm having trouble with a sensor that stops providing data at times cluttering my costmap. To reproduce the problem, I start the system, see the costmap update properly, then unplug the sensor. The last sensor reading stays in the costmap.

I tracked this down to the following function:

bool Costmap2DROS::getMarkingObservations(std::vector<Observation>& marking_observations) const {
  bool current = true;
  //get the marking observations
  for(unsigned int i = 0; i < marking_buffers_.size(); ++i){
    marking_buffers_[i]->lock();
    marking_buffers_[i]->getObservations(marking_observations);
    current = marking_buffers_[i]->isCurrent() && current;
    marking_buffers_[i]->unlock();
  }
  return current;
}

getObservations() removes stale observations, but it keeps one observation. As a result, the last reading from the sensor continues to be used as a marking observation.

The following change allows me to drop the sensor as soon as it is detected as no longer active. Are there any implications of this change I'm missing, or do people have other ways of dealing with sensors that stop providing data?

bool Costmap2DROS::getMarkingObservations(std::vector<Observation>& marking_observations) const {
  bool current = true;
  //get the marking observations
  for(unsigned int i = 0; i < marking_buffers_.size(); ++i){
    marking_buffers_[i]->lock();
    bool obsCurrent = marking_buffers_[i]->isCurrent();
    if (obsCurrent) {
      marking_buffers_[i]->getObservations(marking_observations);
    }
    current = obsCurrent && current;
    marking_buffers_[i]->unlock();
  }
  return current;
}
edit retag flag offensive close merge delete

Comments

@David Lu is this a good patch?

tfoote gravatar image tfoote  ( 2014-06-05 09:15:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-06-13 12:42:58 -0500

David Lu gravatar image

This looks good as far as I can tell.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-03-02 09:11:46 -0500

Seen: 315 times

Last updated: Mar 02 '12