Apollo  6.0
Open source self driving car software
feature_output.h
Go to the documentation of this file.
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
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 <mutex>
20 #include <string>
21 #include <vector>
22 
24 #include "modules/prediction/proto/offline_features.pb.h"
25 #include "modules/prediction/proto/prediction_obstacle.pb.h"
26 
27 namespace apollo {
28 namespace prediction {
29 
31  public:
35  FeatureOutput() = delete;
36 
40  static void Close();
41 
45  static void Clear();
46 
51  static bool Ready();
52 
57  static void InsertFeatureProto(const Feature& feature);
58 
63  static void InsertDataForLearning(const Feature& feature,
64  const std::vector<double>& feature_values,
65  const std::string& category,
66  const LaneSequence* lane_sequence_ptr);
67 
68  static void InsertDataForLearning(
69  const Feature& feature, const std::vector<double>& feature_values,
70  const std::vector<std::string>& string_feature_values,
71  const std::string& category, const LaneSequence* lane_sequence_ptr);
72 
80  static void InsertPredictionResult(
81  const Obstacle* obstacle, const PredictionObstacle& prediction_obstacle,
82  const ObstacleConf& obstacle_conf, const Scenario& scenario);
83 
88  static void InsertFrameEnv(const FrameEnv& frame_env);
89 
98  static void InsertDataForTuning(
99  const Feature& feature, const std::vector<double>& feature_values,
100  const std::string& category, const LaneSequence& lane_sequence,
101  const std::vector<apollo::common::TrajectoryPoint>& adc_trajectory);
102 
106  static void WriteFeatureProto();
107 
111  static void WriteDataForLearning();
112 
116  static void WritePredictionResult();
117 
121  static void WriteFrameEnv();
122 
126  static void WriteDataForTuning();
127 
132  static int Size();
133 
138  static int SizeOfDataForLearning();
139 
144  static int SizeOfPredictionResult();
145 
150  static int SizeOfFrameEnv();
151 
156  static int SizeOfDataForTuning();
157 
158  private:
159  static Features features_;
160  static std::size_t idx_feature_;
161  static ListDataForLearning list_data_for_learning_;
162  static std::size_t idx_learning_;
163  static ListPredictionResult list_prediction_result_;
164  static std::size_t idx_prediction_result_;
165  static ListFrameEnv list_frame_env_;
166  static std::size_t idx_frame_env_;
167  static ListDataForTuning list_data_for_tuning_;
168  static std::size_t idx_tuning_;
169  static std::mutex mutex_feature_;
170 };
171 
172 } // namespace prediction
173 } // namespace apollo
Definition: feature_output.h:30
FeatureOutput()=delete
Constructor; disabled.
static void InsertFrameEnv(const FrameEnv &frame_env)
Insert a frame env.
static int Size()
Get feature size.
static int SizeOfFrameEnv()
Get the size of frame env.
Prediction obstacle.
Definition: obstacle.h:52
static int SizeOfPredictionResult()
Get the size of prediction results.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
static void InsertDataForLearning(const Feature &feature, const std::vector< double > &feature_values, const std::string &category, const LaneSequence *lane_sequence_ptr)
Insert a data_for_learning.
Obstacle.
static void WriteDataForTuning()
Write DataForTuning features to a file.
static int SizeOfDataForLearning()
Get the size of data_for_learning features.
static void WriteFrameEnv()
Write frame env to a file.
static void WriteDataForLearning()
Write DataForLearning features to a file.
static void InsertDataForTuning(const Feature &feature, const std::vector< double > &feature_values, const std::string &category, const LaneSequence &lane_sequence, const std::vector< apollo::common::TrajectoryPoint > &adc_trajectory)
Insert a data_for_tuning.
static int SizeOfDataForTuning()
Get the size of data for tuning.
static void WritePredictionResult()
Write PredictionResult to a file.
static void InsertFeatureProto(const Feature &feature)
Insert a feature.
static void InsertPredictionResult(const Obstacle *obstacle, const PredictionObstacle &prediction_obstacle, const ObstacleConf &obstacle_conf, const Scenario &scenario)
Insert a prediction result with predicted trajectories.
static void Close()
Close the output stream.
static bool Ready()
Check if output is ready.
static void WriteFeatureProto()
Write features to a file.