Apollo  6.0
Open source self driving car software
laneline_calibrator.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 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 #pragma once
17 
18 #include <string>
19 #include <vector>
20 
23 
25 
26 namespace apollo {
27 namespace perception {
28 namespace camera {
29 
31  public:
33 
34  virtual ~LaneLineCalibrator() {}
35 
36  bool Init(
37  const CalibratorInitOptions &options = CalibratorInitOptions()) override;
38 
39  // @brief: estimate camera-ground plane pitch.
40  // @param [in]: options
41  // @param [in/out]: pitch_angle
42  bool Calibrate(const CalibratorOptions &options, float *pitch_angle) override;
43 
44  std::string Name() const override { return "LaneLineCalibrator"; }
45 
46  inline float GetTimeDiff() const { return time_diff_; }
47  inline float GetYawRate() const { return yaw_rate_; }
48  inline float GetVelocity() const { return velocity_; }
49  inline float GetVanishingRow() const {
50  return calibrator_.get_vanishing_row();
51  }
52 
53  private:
54  // @brief: load ego lane line from camera frame
55  // @param [in]: lane_objects
56  // @param [out]: ego_lane
57  bool LoadEgoLaneline(const std::vector<base::LaneLine> &lane_objects,
58  EgoLane *ego_lane);
59 
60  private:
61  int image_width_ = 0;
62  int image_height_ = 0;
63  double cam_coord_pre_pre_[3] = {0.0f};
64  double cam_coord_pre_[3] = {0.0f};
65  double cam_coord_cur_[3] = {0.0f};
66  double timestamp_pre_ = 0.0f;
67  double timestamp_cur_ = 0.0f;
68  bool is_first_frame_ = true;
69  float time_diff_ = kTimeDiffDefault;
70  float yaw_rate_ = kYawRateDefault;
71  float velocity_ = kVelocityDefault;
72  LaneBasedCalibrator calibrator_;
73 };
74 
75 } // namespace camera
76 } // namespace perception
77 } // namespace apollo
Definition: laneline_calibrator.h:30
float GetVelocity() const
Definition: laneline_calibrator.h:48
Definition: lane_struct_for_calib.h:51
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::string Name() const override
Definition: laneline_calibrator.h:44
virtual ~LaneLineCalibrator()
Definition: laneline_calibrator.h:34
float get_vanishing_row() const
Definition: lane_based_calibrator.h:99
LaneLineCalibrator()
Definition: laneline_calibrator.h:32
Definition: base_calibrator.h:40
bool Calibrate(const CalibratorOptions &options, float *pitch_angle) override
bool Init(const CalibratorInitOptions &options=CalibratorInitOptions()) override
const float kVelocityDefault
Definition: lane_based_calibrator.h:30
Definition: base_calibrator.h:46
float GetVanishingRow() const
Definition: laneline_calibrator.h:49
float GetTimeDiff() const
Definition: laneline_calibrator.h:46
float GetYawRate() const
Definition: laneline_calibrator.h:47
const float kTimeDiffDefault
Definition: lane_based_calibrator.h:31
const float kYawRateDefault
Definition: lane_based_calibrator.h:29
Definition: lane_based_calibrator.h:75