Program Listing for File PointcloudProcessor.hpp

Return to documentation for file (/tmp/ws/src/grid_map/grid_map_pcl/include/grid_map_pcl/PointcloudProcessor.hpp)

/*
 * PointcloudProcessor.hpp
 *
 *  Created on: Nov 21, 2019
 *      Author: Edo Jelavic
 *      Institute: ETH Zurich, Robotic Systems Lab
 */

#ifndef GRID_MAP_PCL__POINTCLOUDPROCESSOR_HPP_
#define GRID_MAP_PCL__POINTCLOUDPROCESSOR_HPP_

#include <string>
#include <vector>
#include <memory>

#include "grid_map_pcl/helpers.hpp"
#include "grid_map_pcl/PclLoaderParameters.hpp"

namespace grid_map
{
namespace grid_map_pcl
{

class PointcloudProcessor
{
public:
  explicit PointcloudProcessor(const rclcpp::Logger & node_logger);
  virtual ~PointcloudProcessor() = default;

  void loadParameters(const std::string & filename);

  Pointcloud::Ptr removeOutliersFromInputCloud(Pointcloud::ConstPtr inputCloud) const;

  Pointcloud::Ptr downsampleInputCloud(Pointcloud::ConstPtr inputCloud) const;

  std::vector<pcl::PointIndices> extractClusterIndicesFromPointcloud(
    Pointcloud::ConstPtr inputCloud) const;

  std::vector<Pointcloud::Ptr> extractClusterCloudsFromPointcloud(
    Pointcloud::ConstPtr inputCloud) const;

  Pointcloud::Ptr makeCloudFromIndices(
    const std::vector<int> & indices,
    Pointcloud::ConstPtr inputCloud) const;

  void savePointCloudAsPcdFile(const std::string & filename, const Pointcloud & cloud) const;


  Pointcloud::Ptr applyRigidBodyTransformation(Pointcloud::ConstPtr inputCloud) const;

protected:
  // Parameters for the pcl filters.
  std::unique_ptr<grid_map_pcl::PclLoaderParameters> params_;

private:
  // Logging interface
  rclcpp::Logger node_logger_;
};

}  // namespace grid_map_pcl

}  // namespace grid_map
#endif  // GRID_MAP_PCL__POINTCLOUDPROCESSOR_HPP_