Apollo  6.0
Open source self driving car software
trajectory_cost.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
21 #pragma once
22 
23 #include "modules/common/configs/proto/vehicle_config.pb.h"
29 #include "modules/planning/proto/dp_poly_path_config.pb.h"
32 
33 namespace apollo {
34 namespace planning {
35 
37  public:
38  TrajectoryCost() = default;
39  TrajectoryCost(const DpPolyPathConfig &config,
40  const ReferenceLine &reference_line,
41  const bool is_change_lane_path,
42  const std::vector<const Obstacle *> &obstacles,
43  const common::VehicleParam &vehicle_param,
44  const SpeedData &heuristic_speed_data,
45  const common::SLPoint &init_sl_point,
46  const SLBoundary &adc_sl_boundary);
48  const double start_s, const double end_s,
49  const uint32_t curr_level,
50  const uint32_t total_level);
51 
52  private:
53  ComparableCost CalculatePathCost(const QuinticPolynomialCurve1d &curve,
54  const double start_s, const double end_s,
55  const uint32_t curr_level,
56  const uint32_t total_level);
57  ComparableCost CalculateStaticObstacleCost(
58  const QuinticPolynomialCurve1d &curve, const double start_s,
59  const double end_s);
60  ComparableCost CalculateDynamicObstacleCost(
61  const QuinticPolynomialCurve1d &curve, const double start_s,
62  const double end_s) const;
63  ComparableCost GetCostBetweenObsBoxes(
64  const common::math::Box2d &ego_box,
65  const common::math::Box2d &obstacle_box) const;
66 
67  FRIEND_TEST(AllTrajectoryTests, GetCostFromObsSL);
68  ComparableCost GetCostFromObsSL(const double adc_s, const double adc_l,
69  const SLBoundary &obs_sl_boundary);
70 
71  common::math::Box2d GetBoxFromSLPoint(const common::SLPoint &sl,
72  const double dl) const;
73 
74  bool IsOffRoad(const double ref_s, const double l, const double dl,
75  const bool is_change_lane_path);
76 
77  const DpPolyPathConfig config_;
78  const ReferenceLine *reference_line_ = nullptr;
79  bool is_change_lane_path_ = false;
80  const common::VehicleParam vehicle_param_;
81  SpeedData heuristic_speed_data_;
82  const common::SLPoint init_sl_point_;
83  const SLBoundary adc_sl_boundary_;
84  uint32_t num_of_time_stamps_ = 0;
85  std::vector<std::vector<common::math::Box2d>> dynamic_obstacle_boxes_;
86  std::vector<double> obstacle_probabilities_;
87 
88  std::vector<SLBoundary> static_obstacle_sl_boundaries_;
89 };
90 
91 } // namespace planning
92 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
ComparableCost Calculate(const QuinticPolynomialCurve1d &curve, const double start_s, const double end_s, const uint32_t curr_level, const uint32_t total_level)
Planning module main class. It processes GPS and IMU as input, to generate planning info...
Definition: quintic_polynomial_curve1d.h:33
Rectangular (undirected) bounding box in 2-D.
Definition: box2d.h:52
Definition: comparable_cost.h:26
Definition: reference_line.h:39
Definition: trajectory_cost.h:36
The class of Box2d. Here, the x/y axes are respectively Forward/Left, as opposed to what happens in e...
Definition: speed_data.h:30