Apollo 11.0
自动驾驶开放平台
gridded_path_time_graph.h
浏览该文件的文档.
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
26#include "modules/common_msgs/config_msgs/vehicle_config.pb.h"
27#include "modules/planning/planning_base/proto/planning_config.pb.h"
28#include "modules/planning/tasks/path_time_heuristic/proto/path_time_heuristic.pb.h"
39
40namespace apollo {
41namespace planning {
42
44 public:
45 GriddedPathTimeGraph(const StGraphData& st_graph_data,
46 const DpStSpeedOptimizerConfig& dp_config,
47 const std::vector<const Obstacle*>& obstacles,
48 const common::TrajectoryPoint& init_point);
49
50 common::Status Search(SpeedData* const speed_data);
51
52 private:
53 common::Status InitCostTable();
54
55 common::Status InitSpeedLimitLookUp();
56
57 common::Status RetrieveSpeedProfile(SpeedData* const speed_data);
58
59 common::Status CalculateTotalCost();
60
61 // defined for cyber task
62 struct StGraphMessage {
63 StGraphMessage(const uint32_t c_, const int32_t r_) : c(c_), r(r_) {}
64 uint32_t c;
65 uint32_t r;
66 };
67 void CalculateCostAt(const std::shared_ptr<StGraphMessage>& msg);
68
69 double CalculateEdgeCost(const STPoint& first, const STPoint& second,
70 const STPoint& third, const STPoint& forth,
71 const double speed_limit, const double cruise_speed);
72 double CalculateEdgeCostForSecondCol(const uint32_t row,
73 const double speed_limit,
74 const double cruise_speed);
75 double CalculateEdgeCostForThirdCol(const uint32_t curr_row,
76 const uint32_t pre_row,
77 const double speed_limit,
78 const double cruise_speed);
79
80 // get the row-range of next time step
81 void GetRowRange(const StGraphPoint& point, size_t* next_highest_row,
82 size_t* next_lowest_row);
83
84 private:
85 const StGraphData& st_graph_data_;
86
87 std::vector<double> speed_limit_by_index_;
88
89 std::vector<double> spatial_distance_by_index_;
90
91 // dp st configuration
92 DpStSpeedOptimizerConfig gridded_path_time_graph_config_;
93
94 // obstacles based on the current reference line
95 const std::vector<const Obstacle*>& obstacles_;
96
97 // vehicle configuration parameter
98 const common::VehicleParam& vehicle_param_ =
100
101 // initial status
102 common::TrajectoryPoint init_point_;
103
104 // cost utility with configuration;
105 DpStCost dp_st_cost_;
106
107 double total_length_t_ = 0.0;
108 double unit_t_ = 0.0;
109 uint32_t dimension_t_ = 0;
110
111 double total_length_s_ = 0.0;
112 double dense_unit_s_ = 0.0;
113 double sparse_unit_s_ = 0.0;
114 uint32_t dense_dimension_s_ = 0;
115 uint32_t sparse_dimension_s_ = 0;
116 uint32_t dimension_s_ = 0;
117
118 double max_acceleration_ = 0.0;
119 double max_deceleration_ = 0.0;
120
121 // cost_table_[t][s]
122 // row: s, col: t --- NOTICE: Please do NOT change.
123 std::vector<std::vector<StGraphPoint>> cost_table_;
124};
125
126} // namespace planning
127} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
static const VehicleConfig & GetConfig()
Get the current vehicle configuration.
common::Status Search(SpeedData *const speed_data)
Planning module main class.
class register implement
Definition arena_queue.h:37
: data with map info and obstacle info
optional VehicleParam vehicle_param