Apollo 10.0
自动驾驶开放平台
jointly_prediction_planning_evaluator.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 implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#pragma once
18
19#include <string>
20#include <utility>
21#include <vector>
22
24#include "torch/extension.h"
25#include "torch/script.h"
28
29namespace apollo {
30namespace prediction {
31
33
35 public:
40
45
49 void Clear();
50
63 ObstaclesContainer* obstacles_container,
64 torch::Tensor* ptr_target_obs_pos,
65 torch::Tensor* ptr_target_obs_pos_step,
66 torch::Tensor* ptr_vector_mask,
67 torch::Tensor* ptr_all_obstacle_pos,
68 torch::Tensor* ptr_all_obs_p_id,
69 torch::Tensor* ptr_obs_length);
70
79 bool VectornetProcessMapData(FeatureVector *map_feature,
80 PidVector *map_p_id,
81 const int obs_num,
82 torch::Tensor* ptr_map_data,
83 torch::Tensor* ptr_all_map_p_id,
84 torch::Tensor* ptr_vector_mask);
85
91 bool Evaluate(Obstacle* obstacle_ptr,
92 ObstaclesContainer* obstacles_container) override;
93
94
101 bool Evaluate(const ADCTrajectoryContainer* adc_trajectory_container,
102 Obstacle* obstacle_ptr,
103 ObstaclesContainer* obstacles_container) override;
104
111 Obstacle* obstacle_ptr, ObstaclesContainer* obstacles_container,
112 std::vector<std::pair<double, double>>* curr_pos_history,
113 std::vector<std::pair<double, double>>* all_obs_length,
114 std::vector<std::vector<std::pair<double, double>>>* all_obs_pos_history,
115 torch::Tensor* vector_mask);
116
123 std::vector<TrajectoryPoint>* trajectory_points,
124 Obstacle* obstacle_ptr,
125 std::vector<std::pair<double, double>>* acd_traj_curr_pos);
126
130 std::string GetName() override {
131 return "JOINTLY_PREDICTION_PLANNING_EVALUATOR";
132 }
133
134 private:
138 void LoadModel();
139
140 private:
141 torch::jit::script::Module torch_vehicle_model_;
142 at::Tensor torch_default_output_tensor_;
143 torch::Device device_;
144 VectorNet vector_net_;
145};
146
147} // namespace prediction
148} // namespace apollo
bool Evaluate(Obstacle *obstacle_ptr, ObstaclesContainer *obstacles_container) override
Override Evaluate
bool VectornetProcessMapData(FeatureVector *map_feature, PidVector *map_p_id, const int obs_num, torch::Tensor *ptr_map_data, torch::Tensor *ptr_all_map_p_id, torch::Tensor *ptr_vector_mask)
Process map data to vector
bool VectornetProcessObstaclePosition(Obstacle *obstacle_ptr, ObstaclesContainer *obstacles_container, torch::Tensor *ptr_target_obs_pos, torch::Tensor *ptr_target_obs_pos_step, torch::Tensor *ptr_vector_mask, torch::Tensor *ptr_all_obstacle_pos, torch::Tensor *ptr_all_obs_p_id, torch::Tensor *ptr_obs_length)
Process obstacle position to vector
bool ExtractADCTrajectory(std::vector< TrajectoryPoint > *trajectory_points, Obstacle *obstacle_ptr, std::vector< std::pair< double, double > > *acd_traj_curr_pos)
Extract adc trajectory and convert world coord to obstacle coord
virtual ~JointlyPredictionPlanningEvaluator()=default
Destructor
bool ExtractObstaclesHistory(Obstacle *obstacle_ptr, ObstaclesContainer *obstacles_container, std::vector< std::pair< double, double > > *curr_pos_history, std::vector< std::pair< double, double > > *all_obs_length, std::vector< std::vector< std::pair< double, double > > > *all_obs_pos_history, torch::Tensor *vector_mask)
Extract all obstacles history
Prediction obstacle.
Definition obstacle.h:52
Use container manager to manage all containers
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
Define the data container base class