filter_pointcloud2_z_value_alg.cpp
Go to the documentation of this file.
00001 #include "filter_pointcloud2_z_value_alg.h"
00002 
00003 FilterPointcloud2ZValueAlgorithm::FilterPointcloud2ZValueAlgorithm(void)
00004 {
00005 }
00006 
00007 FilterPointcloud2ZValueAlgorithm::~FilterPointcloud2ZValueAlgorithm(void)
00008 {
00009 }
00010 
00011 void FilterPointcloud2ZValueAlgorithm::config_update(Config& new_cfg, uint32_t level)
00012 {
00013     this->lock();
00014 
00015     // save the current configuration
00016     this->config_=new_cfg;
00017 
00018     this->unlock();
00019 }
00020 
00021 // FilterPointcloud2ZValueAlgorithm Public API
00022 
00023 bool FilterPointcloud2ZValueAlgorithm::apply_z_value_filter(const sensor_msgs::PointCloud2::ConstPtr& msg)
00024 {
00025     nan_pc_ = *msg;
00026     max_pc_ = *msg;
00027 
00028     for (unsigned int rr=0; rr<msg->height; ++rr){
00029         for (unsigned int cc=0; cc<msg->width; ++cc){
00030             int idx0 = rr*msg->width + cc;
00031             float *nan_step = (float*)&nan_pc_.data[idx0 * nan_pc_.point_step];
00032             float *max_step = (float*)&max_pc_.data[idx0 * max_pc_.point_step];
00033 
00034             // Bounding Box Threshold
00035             //std::cout << std::endl << " z_e: " << nan_step[2];
00036             if ( nan_step[2] > z_thr_)
00037             {
00038                 nan_step[2] = std::numeric_limits<float>::quiet_NaN ();
00039                 max_step[2] = 7.5f;
00040                 nan_pc_.is_dense = false;
00041             }
00042         }
00043     }
00044     return true;
00045 }
00046 
00047 sensor_msgs::PointCloud2* FilterPointcloud2ZValueAlgorithm::get_nan_pc(void)
00048 {
00049   return &nan_pc_;
00050 }
00051 
00052 sensor_msgs::PointCloud2* FilterPointcloud2ZValueAlgorithm::get_max_pc(void)
00053 {
00054   return &max_pc_;
00055 }
00056 
00057 void FilterPointcloud2ZValueAlgorithm::set_z_thr(double z_thr)
00058 {
00059   z_thr_ = z_thr;
00060 }
00061 


iri_filter_pointcloud2_z_value
Author(s): Sergi Foix
autogenerated on Fri Dec 6 2013 22:34:10