Program Listing for File jump_distance.hpp

Return to documentation for file (include/laser_segmentation/segmentation/jump_distance.hpp)

// Copyright (c) 2017 Alberto J. Tudela Roldán
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef LASER_SEGMENTATION__SEGMENTATION__JUMP_DISTANCE_HPP_
#define LASER_SEGMENTATION__SEGMENTATION__JUMP_DISTANCE_HPP_

// C++
#include <memory>
#include <string>
#include <vector>

#include "laser_segmentation/segmentation/segmentation.hpp"

namespace laser_segmentation
{

class JumpDistanceSegmentation : public Segmentation
{
public:
  JumpDistanceSegmentation() = default;

  ~JumpDistanceSegmentation() override = default;

  void initialize_segmentation(
    double distance, double angle_resolution,
    double noise_reduction, std::string method = "") override;

  void perform_segmentation(
    const std::vector<slg::Point2D> points,
    std::vector<slg::Segment2D> & segments) override;

protected:
  bool is_jump_between(const slg::Point2D point1, const slg::Point2D point2);

  bool is_jump_between(const slg::Segment2D segment1, const slg::Segment2D segment2);

  double calculate_lee_threshold(const slg::Point2D point1, const slg::Point2D point2);

  double calculate_diet_threshold(const slg::Point2D point1, const slg::Point2D point2);

  double calculate_santos_threshold(const slg::Point2D point1, const slg::Point2D point2);

  double jump_distance_;

  double angle_resolution_;

  double noise_reduction_;

  std::string threshold_method_;
};

}  // namespace laser_segmentation

#endif  // LASER_SEGMENTATION__SEGMENTATION__JUMP_DISTANCE_HPP_