29   m_motionRangeZ(-1.0), m_motionRangeRoll(-1.0), m_motionRangePitch(-1.0),
    30   m_motionObstacleDist(0.2)
    53   double minX, minY, minZ, maxX, maxY, maxZ;
    54   m_map->getMetricMin(minX, minY, minZ);
    55   m_map->getMetricMax(maxX, maxY, maxZ);
    58   double minWeight = std::numeric_limits<double>::max();
    59   for (Particles::iterator it = particles.begin(); it != particles.end(); ++it) {
    60     if (it->weight < minWeight)
    61       minWeight = it->weight;
    69   unsigned numMotion = 0;
    74 #pragma omp parallel for    75   for (
unsigned i = 0; i < particles.size(); ++i){
    78                               particles[i].pose.getOrigin().getY(),
    79                               particles[i].pose.getOrigin().getZ());
    82     if (position(0) < minX || position(0) > maxX
    83         ||      position(1) < minY || position(1) > maxY
    84         ||      position(2) < minZ || position(2) > maxZ)
    86       particles[i].weight = minWeight;
    93         particles[i].weight = minWeight;
   102           particles[i].weight = minWeight;
   107           double yaw, pitch, roll;
   108           particles[i].pose.getBasis().getRPY(roll, pitch, yaw);
   113             particles[i].weight = minWeight;
   122   if (numWall > 0 || numOut > 0 || numMotion > 0){
   123     ROS_INFO(
"Particle weights minimized: %d out of map, %d in obstacles, %d out of motion range", numOut, numWall, numMotion);
   126   if (numOut + numWall >= particles.size()){
   127     ROS_WARN(
"All particles are out of the valid map area or in obstacles!");
   136   double sizeX,sizeY,sizeZ, minX, minY, minZ;
   137   m_map->getMetricSize(sizeX,sizeY,sizeZ);
   138   m_map->getMetricMin(minX, minY, minZ);
   140   double weight = 1.0 / particles.size();
   141   Particles::iterator it = particles.begin();
   143     if (it == particles.end())
   146     double x = minX + sizeX * rngUniform();
   147     double y = minY + sizeY * rngUniform();
   148     std::vector<double> z_list;
   151     for (
unsigned zIdx = 0; zIdx < z_list.size(); zIdx++){
   152       if (it == particles.end())
   160       it->pose.getOrigin().setX(x);
   161       it->pose.getOrigin().setY(y);
   163       it->pose.getOrigin().setZ(z_list.at(zIdx) + z + rngNormal() * initNoise(2));
   164       double yaw = rngUniform() * 2 * 
M_PI  -
M_PI;
   174   double minX, minY, minZ, maxX, maxY, maxZ;
   175   m_map->getMetricMin(minX, minY, minZ);
   176   m_map->getMetricMax(maxX, maxY, maxZ);
   178   double res = 
m_map->getResolution();
   180   double z =  maxZ-res/2.0;
   181   double lastZ = z + res;
   185       if (lastZ - z >= totalHeight + res){
   186         heights.push_back(z+ res/2.0);
   210   ROS_ERROR(
"Distance map implementation is currently not supported");
   211   std::string mapFileName;
   212   nh->
getParam(
"map_file_dist", mapFileName);
   227     ROS_ERROR(
"Distance map file loaded from \"%s\" is erroneous, exiting...", mapFileName.c_str());
   231   m_map->getMetricSize(x,y,z);
   232   ROS_INFO(
"Distance map initialized with %zd nodes (%.2f x %.2f x %.2f m)", 
m_map->size(), x,y,z);
   249   ROS_ERROR(
"DistanceMap::getFloorHeight not implemented yet!");
   262   std::string servname = 
"octomap_binary";
   264   octomap_msgs::GetOctomap::Request req;
   265   octomap_msgs::GetOctomap::Response resp;
   274 #if ROS_VERSION_MINIMUM(1, 9, 0)   277   m_map.reset(octomap_msgs::binaryMsgDataToMap(resp.map.data));
   281     ROS_ERROR(
"Occupancy map is erroneous, exiting...");
   285   m_map->getMetricSize(x,y,z);
   286   ROS_INFO(
"Occupancy map initialized with %zd nodes (%.2f x %.2f x %.2f m), %f m res.", 
m_map->size(), x,y,z, 
m_map->getResolution());
   288   m_map->writeBinary(
"/tmp/octomap_loc");
   297   return m_map->isNodeOccupied(node);
   305     return end.
z()+
m_map->getResolution()/2.0;
   307     ROS_WARN(
"getFloorHeight raycast did not succeed, using 0.0");
 
static tf::Quaternion createQuaternionFromRPY(double roll, double pitch, double yaw)
 
virtual void verifyPoses(Particles &particles)
 
MapModel(ros::NodeHandle *nh)
 
boost::shared_ptr< octomap::OcTree > getMap() const 
 
boost::variate_generator< EngineT &, NormalDistributionT > NormalGeneratorT
standard normal-distributed noise 
 
static AbstractOcTree * read(const std::string &filename)
 
virtual double getFloorHeight(const tf::Transform &pose) const 
 
std::string resolveName(const std::string &name, bool remap=true) const 
 
bool call(const std::string &service_name, MReq &req, MRes &res)
 
TFSIMD_FORCE_INLINE const tfScalar & y() const 
 
static octomap::point3d pointTfToOctomap(const tf::Point &ptTf)
 
DistanceMap(ros::NodeHandle *nh)
 
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const 
 
boost::shared_ptr< octomap::OcTree > m_map
 
boost::variate_generator< EngineT &, UniformDistributionT > UniformGeneratorT
uniform noise in range [0,1) 
 
static octomap::AbstractOcTree * binaryMsgToMap(const Octomap &msg)
 
Eigen::Matrix< double, 6, 1 > Vector6d
 
TFSIMD_FORCE_INLINE const tfScalar & x() const 
 
virtual bool isOccupied(const octomap::point3d &position) const 
 
virtual void initGlobal(Particles &particles, double z, double roll, double pitch, const Vector6d &initNoise, UniformGeneratorT &rngUniform, NormalGeneratorT &rngNormal)
 
TFSIMD_FORCE_INLINE const tfScalar & z() const 
 
OccupancyMap(ros::NodeHandle *nh)
 
bool getParam(const std::string &key, std::string &s) const 
 
void getHeightlist(double x, double y, double totalHeight, std::vector< double > &heights)
 
virtual double getFloorHeight(const tf::Transform &pose) const 
 
virtual double getFloorHeight(const tf::Transform &pose) const =0
 
double m_motionRangePitch
 
std::vector< Particle > Particles
 
virtual bool isOccupied(octomap::OcTreeNode *node) const 
 
virtual bool isOccupied(octomap::OcTreeNode *node) const