36 #define BOOST_PARAMETER_MAX_ARITY 7
38 #include <pcl/range_image/range_image_planar.h>
39 #include <pcl/range_image/range_image_spherical.h>
48 ConnectionBasedNodelet::onInit();
50 pnh_->param(
"model_type",
model_type_, std::string(
"planar"));
51 srv_ = boost::make_shared <dynamic_reconfigure::Server<Config> > (*pnh_);
52 typename dynamic_reconfigure::Server<Config>::CallbackType
f =
54 srv_->setCallback (
f);
56 pub_border_ = advertise<PCLIndicesMsg>(*pnh_,
"output_border_indices", 1);
57 pub_veil_ = advertise<PCLIndicesMsg>(*pnh_,
"output_veil_indices", 1);
58 pub_shadow_ = advertise<PCLIndicesMsg>(*pnh_,
"output_shadow_indices", 1);
60 *pnh_,
"output_range_image", 1);
61 pub_cloud_ = advertise<sensor_msgs::PointCloud2>(
62 *pnh_,
"output_cloud", 1);
83 sync_ = boost::make_shared<message_filters::Synchronizer<SyncPolicy> >(100);
105 const pcl::PointIndices& inlier,
106 const std_msgs::Header&
header)
110 msg.indices = inlier.indices;
115 const sensor_msgs::PointCloud2::ConstPtr&
msg)
118 pcl::PointCloud<pcl::PointXYZ>::Ptr
cloud (
new pcl::PointCloud<pcl::PointXYZ>);
120 pcl::RangeImage range_image;
122 range_image = pcl::RangeImageSpherical();
124 range_image.createFromPointCloud(
128 Eigen::Affine3f::Identity(),
129 pcl::RangeImage::CAMERA_FRAME,
133 range_image.setUnseenToMaxRange();
138 const pcl::RangeImage& range_image,
139 const std_msgs::Header&
header)
141 pcl::RangeImageBorderExtractor border_extractor (&range_image);
142 pcl::PointCloud<pcl::BorderDescription> border_descriptions;
143 border_extractor.compute (border_descriptions);
144 pcl::PointIndices border_indices, veil_indices, shadow_indices;
145 for (
int y = 0;
y < (int)range_image.height; ++
y) {
146 for (
int x = 0;
x < (int)range_image.width; ++
x) {
147 if (border_descriptions.points[
y*range_image.width +
x].traits[pcl::BORDER_TRAIT__OBSTACLE_BORDER]) {
148 border_indices.indices.push_back (
y*range_image.width +
x);
150 if (border_descriptions.points[
y*range_image.width +
x].traits[pcl::BORDER_TRAIT__VEIL_POINT]) {
151 veil_indices.indices.push_back (
y*range_image.width +
x);
153 if (border_descriptions.points[
y*range_image.width +
x].traits[pcl::BORDER_TRAIT__SHADOW_BORDER]) {
154 shadow_indices.indices.push_back (
y*range_image.width +
x);
166 image).toImageMsg());
168 sensor_msgs::PointCloud2 ros_cloud;
170 ros_cloud.header =
header;
175 const sensor_msgs::PointCloud2::ConstPtr&
msg,
176 const sensor_msgs::CameraInfo::ConstPtr& info)
178 if (
msg->height == 1) {
179 NODELET_ERROR(
"[BorderEstimator::estimate] pointcloud must be organized");
182 pcl::RangeImagePlanar range_image;
183 pcl::PointCloud<pcl::PointXYZ>
cloud;
185 Eigen::Affine3f dummytrans = Eigen::Affine3f::Identity();
186 float fx =
info->P[0];
187 float cx =
info->P[2];
188 float tx =
info->P[3];
189 float fy =
info->P[5];
190 float cy =
info->P[6];
191 range_image.createFromPointCloudWithFixedSize (
cloud,
197 range_image.setUnseenToMaxRange();