hdmap_input.h 2.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/******************************************************************************
 * Copyright 2017 The Apollo Authors. All Rights Reserved.
 *
 * 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 MODULES_PERCEPTION_ONBOARD_HDMAP_INPUT_H_
#define MODULES_PERCEPTION_ONBOARD_HDMAP_INPUT_H_

#include <mutex>
#include "modules/common/macro.h"
#include "modules/map/hdmap/hdmap.h"
#include "modules/perception/lib/base/singleton.h"
24
#include "modules/perception/lib/pcl_util/pcl_types.h"
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
#include "modules/perception/obstacle/base/types.h"
#include "modules/perception/obstacle/base/hdmap_struct.h"

namespace apollo {
namespace perception {

// Singleton HDMapInput, interfaces are thread-safe.
class HDMapInput {
 public:
  // thread safe
  bool Init();

  // @brief: get roi polygon
  //         all points are in the world frame
  bool GetROI(const pcl_util::PointD& pointd, HdmapStructPtr mapptr);

 private:
  HDMapInput() = default;

  /*
  void DownSampleBoundary(const apollo::hdmap::LineSegment& line,
                          PolygonDType* out_boundary_line) const;

  int MergeBoundaryJunction(
      std::vector<apollo::hdmap::RoadBoundaryPtr>& boundaries,
50
      std::vector<apollo::hdmap::JunctionInfoConstPtr>& junctions,
51 52
      HdmapStructPtr mapptr);
  */
53

54 55 56 57 58 59 60 61 62 63 64 65 66
  friend class Singleton<HDMapInput>;

  bool inited_ = false;
  std::mutex mutex_;  // multi-thread init safe.
  std::unique_ptr<apollo::hdmap::HDMap> hdmap_;

  DISALLOW_COPY_AND_ASSIGN(HDMapInput);
};

}  // namespace perception
}  // namespace apollo

#endif  // ADU_PERCEPTION_ONBOARD_HDMAP_INPUT_H