Apollo 10.0
自动驾驶开放平台
vector_net.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2021 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
13 *implied. See the License for the specific language governing
14 *permissions and limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <deque>
20#include <map>
21#include <vector>
22#include <string>
23
24#include "modules/prediction/proto/vector_net.pb.h"
29
30namespace apollo {
31namespace prediction {
32
33using FeatureVector = std::vector<std::vector<std::vector<double>>>;
34using PidVector = std::vector<std::vector<double>>;
35
48
55
56class VectorNet {
57 public:
59
60 ~VectorNet() = default;
61
62 bool query(const common::PointENU& center_point, const double obstacle_phi,
63 FeatureVector* const feature_ptr, PidVector* const p_id_ptr);
64
65 bool offline_query(const double obstacle_x, const double obstacle_y,
66 const double obstacle_phi);
67
68 bool offline_query(const double obstacle_x, const double obstacle_y,
69 const double obstacle_phi, const std::string file_name);
70
71 private:
72 // TODO(Yiqun): 1.Left/Right boundary 2.Ordinal Encoding
73 const std::map<ATTRIBUTE_TYPE, double> attribute_map{
74 {ROAD, 0.0},
75 {LANE_UNKOWN, 1.0},
76 {LANE_DOTTED_YELLOW, 2.0},
77 {LANE_DOTTED_WHITE, 3.0},
78 {LANE_SOLID_YELLOW, 4.0},
79 {LANE_SOLID_WHITE, 5.0},
80 {LANE_DOUBLE_YELLOW, 6.0},
81 {LANE_CURB, 7.0},
82 {JUNCTION, 8.0},
83 {CROSSWALK, 9.0},
84 };
85
86 const std::map<BOUNDARY_TYPE, double> boundary_map{
87 {UNKNOW, 0.0}, {NORMAL, 1.0}, {LEFT_BOUNDARY, 2.0}, {RIGHT_BOUNDARY, 3.0},
88 };
89
90 const std::map<hdmap::LaneBoundaryType::Type, ATTRIBUTE_TYPE> lane_attr_map{
98 };
99
100 template <typename Points>
101 void GetOnePolyline(const Points& points, double* start_length,
102 const common::PointENU& center_point,
103 const double obstacle_phi, ATTRIBUTE_TYPE attr_type,
104 BOUNDARY_TYPE bound_type, const int count,
105 std::vector<std::vector<double>>* const one_polyline,
106 std::vector<double>* const one_p_id);
107
108 void GetRoads(const common::PointENU& center_point, const double obstacle_phi,
109 FeatureVector* const feature_ptr, PidVector* const p_id_ptr);
110
111 void GetLaneQueue(
112 const std::vector<hdmap::LaneInfoConstPtr>& lanes,
113 std::vector<std::deque<hdmap::LaneInfoConstPtr>>* const lane_deque_ptr);
114
115 void GetLanes(const common::PointENU& center_point, const double obstacle_phi,
116 FeatureVector* const feature_ptr, PidVector* const p_id_ptr);
117 void GetJunctions(const common::PointENU& center_point,
118 const double obstacle_phi, FeatureVector* const feature_ptr,
119 PidVector* const p_id_ptr);
120 void GetCrosswalks(const common::PointENU& center_point,
121 const double obstacle_phi,
122 FeatureVector* const feature_ptr,
123 PidVector* const p_id_ptr);
124 int count_ = 0;
125};
126
127} // namespace prediction
128} // namespace apollo
bool offline_query(const double obstacle_x, const double obstacle_y, const double obstacle_phi)
bool query(const common::PointENU &center_point, const double obstacle_phi, FeatureVector *const feature_ptr, PidVector *const p_id_ptr)
Linear interpolation functions.
std::vector< std::vector< double > > PidVector
Definition vector_net.h:34
std::vector< std::vector< std::vector< double > > > FeatureVector
Definition vector_net.h:33
class register implement
Definition arena_queue.h:37