st_boundary_mapper.h 3.5 KB
Newer Older
Z
Zhang Liangliang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/******************************************************************************
 * 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.
 *****************************************************************************/

/**
D
Dong Li 已提交
18 19
*   @file
**/
Z
Zhang Liangliang 已提交
20 21 22 23

#ifndef MODULES_PLANNING_OPTIMIZER_ST_GRAPH_ST_BOUNDARY_MAPPER_H_
#define MODULES_PLANNING_OPTIMIZER_ST_GRAPH_ST_BOUNDARY_MAPPER_H_

A
Aaron Xiao 已提交
24 25
#include <vector>

D
Dong Li 已提交
26
#include "modules/common/configs/proto/vehicle_config.pb.h"
27
#include "modules/common/status/status.h"
28 29
#include "modules/planning/proto/st_boundary_config.pb.h"

Z
Zhang Liangliang 已提交
30
#include "modules/planning/common/path/path_data.h"
31
#include "modules/planning/common/path_decision.h"
Z
Zhang Liangliang 已提交
32 33 34 35 36 37 38
#include "modules/planning/common/speed_limit.h"
#include "modules/planning/optimizer/st_graph/st_graph_boundary.h"
#include "modules/planning/reference_line/reference_line.h"

namespace apollo {
namespace planning {

39
class StBoundaryMapper {
Z
Zhang Liangliang 已提交
40
 public:
D
Dong Li 已提交
41
  StBoundaryMapper(const StBoundaryConfig& config,
42
                   const ReferenceLine& reference_line,
43 44
                   const PathData& path_data, const double planning_distance,
                   const double planning_time);
45

D
Dong Li 已提交
46
  apollo::common::Status GetGraphBoundary(
47
      const PathDecision& path_decision,
D
Dong Li 已提交
48
      std::vector<StGraphBoundary>* const boundary) const;
Z
Zhang Liangliang 已提交
49

50
  virtual apollo::common::Status GetSpeedLimits(
51
      SpeedLimit* const speed_limit_data) const;
Z
Zhang Liangliang 已提交
52

D
Dong Li 已提交
53
 private:
54 55 56
  bool CheckOverlap(const apollo::common::PathPoint& path_point,
                    const apollo::common::math::Box2d& obs_box,
                    const double buffer) const;
Z
Zhang Liangliang 已提交
57

D
Dong Li 已提交
58 59
  double GetArea(const std::vector<STPoint>& boundary_points) const;

60 61 62 63 64
  bool GetOverlapBoundaryPoints(
      const std::vector<apollo::common::PathPoint>& path_points,
      const Obstacle& obstacle, std::vector<STPoint>* upper_points,
      std::vector<STPoint>* lower_points) const;

65 66 67 68
  apollo::common::Status MapObstacleWithoutDecision(
      const PathObstacle& path_obstacle,
      std::vector<StGraphBoundary>* const boundary) const;

69 70 71
  bool MapObstacleWithStopDecision(const PathObstacle& stop_obstacle,
                                   const ObjectDecisionType& stop_decision,
                                   StGraphBoundary* const boundary) const;
Z
Zhang Liangliang 已提交
72

D
Dong Li 已提交
73
  apollo::common::Status MapObstacleWithPredictionTrajectory(
74
      const PathObstacle& path_obstacle, const ObjectDecisionType& obj_decision,
D
Dong Li 已提交
75 76
      std::vector<StGraphBoundary>* const boundary) const;

77
  apollo::common::Status MapFollowDecision(
78
      const PathObstacle& obstacle, const ObjectDecisionType& obj_decision,
79
      StGraphBoundary* const boundary) const;
D
Dong Li 已提交
80

Z
Zhang Liangliang 已提交
81
 private:
82
  StBoundaryConfig st_boundary_config_;
D
Dong Li 已提交
83
  const ReferenceLine& reference_line_;
84
  const PathData& path_data_;
D
Dong Li 已提交
85
  const apollo::common::VehicleParam vehicle_param_;
86 87
  const double planning_distance_;
  const double planning_time_;
88
  double adc_front_s_ = 0.0;
Z
Zhang Liangliang 已提交
89 90 91 92 93 94
};

}  // namespace planning
}  // namespace apollo

#endif  // MODULES_PLANNING_OPTIMIZER_ST_GRAPH_ST_BOUNDARY_MAPPER_H_