Apollo 11.0
自动驾驶开放平台
st_graph_data.cc
浏览该文件的文档.
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
22
24
25namespace apollo {
26namespace planning {
27
29
30void StGraphData::LoadData(const std::vector<const STBoundary*>& st_boundaries,
31 const double min_s_on_st_boundaries,
32 const apollo::common::TrajectoryPoint& init_point,
33 const SpeedLimit& speed_limit,
34 const double cruise_speed,
35 const double path_data_length,
36 const double total_time_by_conf,
37 planning_internal::STGraphDebug* st_graph_debug) {
38 init_ = true;
39 st_boundaries_ = st_boundaries;
40 min_s_on_st_boundaries_ = min_s_on_st_boundaries;
41 init_point_ = init_point;
42 speed_limit_ = speed_limit;
43 cruise_speed_ = cruise_speed;
44 path_data_length_ = path_data_length;
45 total_time_by_conf_ = total_time_by_conf;
46 st_graph_debug_ = st_graph_debug;
47}
48
49const std::vector<const STBoundary*>& StGraphData::st_boundaries() const {
50 return st_boundaries_;
51}
52
54 return min_s_on_st_boundaries_;
55}
56
57const TrajectoryPoint& StGraphData::init_point() const { return init_point_; }
58
59const SpeedLimit& StGraphData::speed_limit() const { return speed_limit_; }
60
62 return cruise_speed_ > 0.0 ? cruise_speed_ : FLAGS_default_cruise_speed;
63}
64
65double StGraphData::path_length() const { return path_data_length_; }
66
67double StGraphData::total_time_by_conf() const { return total_time_by_conf_; }
68
72
74 const std::vector<std::tuple<double, double, double>>& s_boundary,
75 const std::vector<std::tuple<double, double, double>>& v_obs_info) {
76 if (s_boundary.size() != v_obs_info.size()) {
77 return false;
78 }
79 for (size_t i = 0; i < s_boundary.size(); ++i) {
80 auto st_bound_instance = st_drivable_boundary_.add_st_boundary();
81 st_bound_instance->set_t(std::get<0>(s_boundary[i]));
82 st_bound_instance->set_s_lower(std::get<1>(s_boundary[i]));
83 st_bound_instance->set_s_upper(std::get<2>(s_boundary[i]));
84 if (std::get<1>(v_obs_info[i]) > -kObsSpeedIgnoreThreshold) {
85 st_bound_instance->set_v_obs_lower(std::get<1>(v_obs_info[i]));
86 }
87 if (std::get<2>(v_obs_info[i]) < kObsSpeedIgnoreThreshold) {
88 st_bound_instance->set_v_obs_upper(std::get<2>(v_obs_info[i]));
89 }
90 }
91 return true;
92}
93
95 return st_drivable_boundary_;
96}
97
98} // namespace planning
99} // namespace apollo
const STDrivableBoundary & st_drivable_boundary() const
bool SetSTDrivableBoundary(const std::vector< std::tuple< double, double, double > > &s_boundary, const std::vector< std::tuple< double, double, double > > &v_obs_info)
const SpeedLimit & speed_limit() const
const std::vector< const STBoundary * > & st_boundaries() const
double min_s_on_st_boundaries() const
void LoadData(const std::vector< const STBoundary * > &st_boundaries, const double min_s_on_st_boundaries, const apollo::common::TrajectoryPoint &init_point, const SpeedLimit &speed_limit, const double cruise_speed, const double path_data_length, const double total_time_by_conf, planning_internal::STGraphDebug *st_graph_debug)
planning_internal::STGraphDebug * mutable_st_graph_debug()
const apollo::common::TrajectoryPoint & init_point() const
Planning module main class.
constexpr double kObsSpeedIgnoreThreshold
class register implement
Definition arena_queue.h:37
: data with map info and obstacle info