Apollo  6.0
Open source self driving car software
collision_checker.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 <memory>
24 #include <vector>
25 
31 
32 namespace apollo {
33 namespace planning {
34 
36  public:
38  const std::vector<const Obstacle*>& obstacles, const double ego_vehicle_s,
39  const double ego_vehicle_d,
40  const std::vector<common::PathPoint>& discretized_reference_line,
41  const ReferenceLineInfo* ptr_reference_line_info,
42  const std::shared_ptr<PathTimeGraph>& ptr_path_time_graph);
43 
44  bool InCollision(const DiscretizedTrajectory& discretized_trajectory);
45 
46  static bool InCollision(const std::vector<const Obstacle*>& obstacles,
47  const DiscretizedTrajectory& ego_trajectory,
48  const double ego_length, const double ego_width,
49  const double ego_edge_to_center);
50 
51  private:
52  void BuildPredictedEnvironment(
53  const std::vector<const Obstacle*>& obstacles, const double ego_vehicle_s,
54  const double ego_vehicle_d,
55  const std::vector<common::PathPoint>& discretized_reference_line);
56 
57  bool IsEgoVehicleInLane(const double ego_vehicle_s,
58  const double ego_vehicle_d);
59 
60  bool IsObstacleBehindEgoVehicle(
61  const Obstacle* obstacle, const double ego_vehicle_s,
62  const std::vector<apollo::common::PathPoint>& discretized_reference_line);
63 
64  private:
65  const ReferenceLineInfo* ptr_reference_line_info_;
66  std::shared_ptr<PathTimeGraph> ptr_path_time_graph_;
67  std::vector<std::vector<common::math::Box2d>> predicted_bounding_rectangles_;
68 };
69 
70 } // namespace planning
71 } // namespace apollo
This is the class that associates an Obstacle with its path properties. An obstacle&#39;s path properties...
Definition: obstacle.h:60
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: discretized_trajectory.h:32
Planning module main class. It processes GPS and IMU as input, to generate planning info...
ReferenceLineInfo holds all data for one reference line.
Definition: reference_line_info.h:54
CollisionChecker(const std::vector< const Obstacle *> &obstacles, const double ego_vehicle_s, const double ego_vehicle_d, const std::vector< common::PathPoint > &discretized_reference_line, const ReferenceLineInfo *ptr_reference_line_info, const std::shared_ptr< PathTimeGraph > &ptr_path_time_graph)
Definition: collision_checker.h:35
The class of Box2d. Here, the x/y axes are respectively Forward/Left, as opposed to what happens in e...
bool InCollision(const DiscretizedTrajectory &discretized_trajectory)