diff --git a/include/laser_geometry/laser_geometry.h b/include/laser_geometry/laser_geometry.h index f58d4b1..8610915 100644 --- a/include/laser_geometry/laser_geometry.h +++ b/include/laser_geometry/laser_geometry.h @@ -35,6 +35,7 @@ #include #include "boost/numeric/ublas/matrix.hpp" +#include "boost/thread/mutex.hpp" #include "tf/tf.h" @@ -234,6 +235,7 @@ namespace laser_geometry //! Internal map of pointers to stored values std::map* > unit_vector_map_; + boost::mutex guv_mutex_; }; } diff --git a/src/laser_geometry.cpp b/src/laser_geometry.cpp index a2ed1e1..ab60bb5 100644 --- a/src/laser_geometry.cpp +++ b/src/laser_geometry.cpp @@ -152,6 +152,8 @@ namespace laser_geometry const boost::numeric::ublas::matrix& LaserProjection::getUnitVectors_(double angle_min, double angle_max, double angle_increment, unsigned int length) { + boost::mutex::scoped_lock guv_lock(this->guv_mutex_); + //construct string for lookup in the map std::stringstream anglestring; anglestring <