Apollo 10.0
自动驾驶开放平台
st_gap_estimator.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 <algorithm>
24#include <cmath>
25
27
28namespace apollo {
29namespace planning {
30
31// TODO(Jinyun): move to configs
32static constexpr double kOvertakeTimeBuffer = 3.0; // in seconds
33static constexpr double kMinOvertakeDistance = 10.0; // in meters
34static constexpr double kDpSafetyDistance = 20.0; // in meters
35static constexpr double kDpSafetyTimeBuffer = 3.0; // in meters
36
37// TODO(Jinyun): unite gap calculation in dp st and speed decider
38double StGapEstimator::EstimateSafeOvertakingGap() { return kDpSafetyDistance; }
39
40double StGapEstimator::EstimateSafeFollowingGap(const double target_obs_speed) {
41 return target_obs_speed * kDpSafetyTimeBuffer;
42}
43
45 return FLAGS_yield_distance;
46}
47
48// TODO(Jinyun): add more variables to overtaking gap calculation
50 const double target_obs_speed, const double adc_speed) {
51 const double overtake_distance_s =
52 std::fmax(std::fmax(adc_speed, target_obs_speed) * kOvertakeTimeBuffer,
53 kMinOvertakeDistance);
54 return overtake_distance_s;
55}
56
57// TODO(Jinyun): add more variables to follow gap calculation
58double StGapEstimator::EstimateProperFollowingGap(const double adc_speed) {
59 return std::fmax(adc_speed * FLAGS_follow_time_buffer,
60 FLAGS_follow_min_distance);
61}
62
63// TODO(Jinyun): add more variables to yielding gap calculation
65 return FLAGS_yield_distance;
66}
67
68} // namespace planning
69} // namespace apollo
static double EstimateProperOvertakingGap(const double target_obs_speed, const double adc_speed)
static double EstimateProperFollowingGap(const double adc_speed)
static double EstimateSafeFollowingGap(const double target_obs_speed)
Planning module main class.
class register implement
Definition arena_queue.h:37
Defines proper safety distance the ADC should keep from target obstacle considering different informa...