extrapolation_predictor.h 2.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/******************************************************************************
 * Copyright 2019 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

/**
 * @file
19
 * @brief Define extrapolation predictor
20 21 22 23 24 25 26 27 28 29 30 31 32
 */

#pragma once

#include <string>
#include <utility>
#include <vector>

#include "modules/prediction/predictor/sequence/sequence_predictor.h"

namespace apollo {
namespace prediction {

33
class ExtrapolationPredictor : public SequencePredictor {
34 35 36 37
 public:
  /**
   * @brief Constructor
   */
38
  ExtrapolationPredictor();
39 40 41 42

  /**
   * @brief Destructor
   */
43
  virtual ~ExtrapolationPredictor() = default;
44 45 46

  /**
   * @brief Make prediction
47
   * @param ADC trajectory container
48
   * @param Obstacle pointer
49
   * @param Obstacles container
50
   */
51 52
  void Predict(const ADCTrajectoryContainer* adc_trajectory_container,
               Obstacle* obstacle,
53
               ObstaclesContainer* obstacles_container) override;
54 55

 private:
56 57 58 59 60 61 62 63
  struct LaneSearchResult {
    bool found = false;
    std::string lane_id = "";
    int point_index = -1;
  };

  void PostProcess(Trajectory* trajectory_ptr);

64 65
  LaneSearchResult SearchExtrapolationLane(const Trajectory& trajectory,
                                           const int num_tail_point);
66

67
  void ExtrapolateByLane(const LaneSearchResult& lane_search_result,
K
kechxu 已提交
68
                         const double extrapolation_speed,
69 70
                         Trajectory* trajectory_ptr);

71
  void ExtrapolateByFreeMove(const int num_tail_point,
K
kechxu 已提交
72
                             const double extrapolation_speed,
73
                             Trajectory* trajectory_ptr);
K
kechxu 已提交
74 75 76

  double ComputeExtraplationSpeed(const int num_tail_point,
                                  const Trajectory& trajectory);
77 78 79 80
};

}  // namespace prediction
}  // namespace apollo