Apollo 10.0
自动驾驶开放平台
check_pit.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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 *****************************************************************************/
17
18namespace apollo {
19namespace control {
20
21
23 const LonBasedPidControllerConf* conf,
24 double speed,
25 bool replan) {
26 static std::pair<double, int> replan_count(0, 0);
27 // static double pre_station_error = 0;
28
30
31 if (now - replan_count.first > conf->pit_replan_check_time()) {
32 replan_count.first = 0;
33 replan_count.second = 0;
34 }
35
36 if (replan) {
37 if (now - replan_count.first > conf->pit_replan_check_time()) {
38 replan_count.first = now;
39 replan_count.second = 1;
40 } else {
41 replan_count.first = now;
42 replan_count.second++;
43 }
44 }
45
46 const auto& vehicle_param =
48 if (replan_count.second >= conf->pit_replan_check_count() &&
49 abs(speed) < vehicle_param.max_abs_speed_when_stopped()) {
50 return true;
51 } else {
52 return false;
53 }
54}
55
56} // namespace control
57} // namespace apollo
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
static bool CheckInPit(SimpleLongitudinalDebug *debug, const LonBasedPidControllerConf *conf, double speed, bool replan)
Definition check_pit.cc:22
static double NowInSeconds()
gets the current time in second.
Definition clock.cc:56
class register implement
Definition arena_queue.h:37
optional VehicleParam vehicle_param