Apollo 11.0
自动驾驶开放平台
base_stage_cruise.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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
22
23#include <string>
24
25#include "cyber/common/log.h"
30
31namespace apollo {
32namespace planning {
33
35 const PlanningContext* context,
36 const bool right_of_way_status) {
37 const auto& reference_line_info = frame.reference_line_info().front();
38
39 const auto& junction_overlaps =
40 reference_line_info.reference_line().map_path().junction_overlaps();
41 if (junction_overlaps.empty()) {
42 // TODO(all): remove when pnc_junction completely available on map
43 // pnc_junction not exist on map, use current traffic_sign's end_s
44 // get traffic sign overlap along reference line
45 hdmap::PathOverlap* traffic_sign_overlap =
46 GetTrafficSignOverlap(reference_line_info, context);
47 if (!traffic_sign_overlap) {
48 return true;
49 }
50
51 static constexpr double kIntersectionPassDist = 20.0; // unit: m
52 const double adc_back_edge_s =
53 reference_line_info.AdcSlBoundary().start_s();
54 const double distance_adc_pass_traffic_sign =
55 adc_back_edge_s - traffic_sign_overlap->end_s;
56 ADEBUG << "distance_adc_pass_traffic_sign["
57 << distance_adc_pass_traffic_sign << "] traffic_sign_end_s["
58 << traffic_sign_overlap->end_s << "]";
59
60 // set right_of_way_status
61 reference_line_info.SetJunctionRightOfWay(traffic_sign_overlap->start_s,
62 right_of_way_status);
63
64 return distance_adc_pass_traffic_sign >= kIntersectionPassDist;
65 }
66
67 if (!planning::util::CheckInsideJunction(reference_line_info)) {
68 return true;
69 }
70
71 // set right_of_way_status
72 hdmap::PathOverlap junction_overlap;
73 const double adc_front_edge_s = reference_line_info.AdcSlBoundary().end_s();
74 reference_line_info.GetJunction(adc_front_edge_s, &junction_overlap);
75 reference_line_info.SetJunctionRightOfWay(junction_overlap.start_s,
76 right_of_way_status);
77
78 return false;
79}
80
81} // namespace planning
82} // namespace apollo
bool CheckDone(const Frame &frame, const PlanningContext *context, const bool right_of_way_status)
Frame holds all data for one planning cycle.
Definition frame.h:62
const std::list< ReferenceLineInfo > & reference_line_info() const
Definition frame.cc:123
Planning module main class.
#define ADEBUG
Definition log.h:41
bool CheckInsideJunction(const ReferenceLineInfo &reference_line_info)
Definition util.cc:115
class register implement
Definition arena_queue.h:37