28 throw std::runtime_error(
"Please specify parameter " + std::string(
"evidence_timeout") +
" when starting this node.");
51 BOOST_FOREACH(ISM::Object
object,
mBuffer)
55 std::map<std::string, std::map<std::string, KalmanFilter> >::iterator it;
61 std::map<std::string, KalmanFilter>::iterator it2;
64 if((it2 = it->second.find(
object.observedId)) != it->second.end())
67 it2->second.update(
object);
70 ROS_DEBUG_STREAM(
"Object Evidence: replaced object (" <<
object.type <<
", " <<
object.observedId <<
").");
74 it->second.insert(std::pair<std::string, KalmanFilter>(
object.observedId,
KalmanFilter(
object)));
77 ROS_DEBUG_STREAM(
"Object Evidence: object with new identifier found (" <<
object.type <<
", " <<
object.observedId <<
").");
82 std::map<std::string, KalmanFilter> entry;
83 entry.insert(std::pair<std::string, KalmanFilter>(
object.observedId,
KalmanFilter(
object)));
84 mObjectEvidences.insert(std::pair<std::string, std::map<std::string, KalmanFilter> >(
object.type, entry));
88 ROS_DEBUG_STREAM(
"Object Evidence: object with new type and identifier found (" <<
object.type <<
", " <<
object.observedId <<
").");
93 std::map<std::string, std::map<std::string, KalmanFilter> >::iterator it;
98 std::map<std::string, KalmanFilter>::iterator it2 = it->second.begin();
99 if(it2 != it->second.end())
102 if (it2->second.isTimedOut(
mTimeout))
104 ISM::Object
object = it2->second.getObject();
107 it->second.erase(it2++);
108 ROS_DEBUG_STREAM(
"Removed timed out evidence (" <<
object.type <<
", " <<
object.observedId <<
").");
126 std::map<std::string, std::map<std::string, KalmanFilter> >::iterator it;
127 std::map<std::string, KalmanFilter>::iterator it2;
133 for(it2 = it->second.begin(); it2 != it->second.end(); it2++)
136 pEvidences.push_back(it2->second.getObject());
void push(const boost::shared_ptr< const ISM::Object > &pObject)
std::map< std::string, std::map< std::string, KalmanFilter > > mObjectEvidences
std::vector< ISM::Object > mBuffer
#define ROS_DEBUG_STREAM(args)
bool hasWaitingEvidences()
bool getParam(const std::string &key, std::string &s) const
void getEvidences(std::vector< ISM::Object > &pEvidences)