Apollo 10.0
自动驾驶开放平台
apollo::perception::camera::LaneBasedCalibrator类 参考

#include <lane_based_calibrator.h>

apollo::perception::camera::LaneBasedCalibrator 的协作图:

Public 成员函数

 LaneBasedCalibrator ()
 
 ~LaneBasedCalibrator ()
 
void Init (const LocalCalibratorInitOptions &options, const CalibratorParams *params=nullptr)
 
void ClearUp ()
 
bool Process (const EgoLane &lane, const float &velocity, const float &yaw_rate, const float &time_diff)
 
float get_pitch_estimation () const
 
float get_vanishing_row () const
 

静态 Public 属性

static const int kMaxNrHistoryFrames = 1000
 

详细描述

在文件 lane_based_calibrator.h75 行定义.

构造及析构函数说明

◆ LaneBasedCalibrator()

apollo::perception::camera::LaneBasedCalibrator::LaneBasedCalibrator ( )
inline

在文件 lane_based_calibrator.h79 行定义.

79{ vp_buffer_.clear(); }

◆ ~LaneBasedCalibrator()

apollo::perception::camera::LaneBasedCalibrator::~LaneBasedCalibrator ( )
inline

成员函数说明

◆ ClearUp()

void apollo::perception::camera::LaneBasedCalibrator::ClearUp ( )

在文件 lane_based_calibrator.cc113 行定义.

113 {
114 vp_buffer_.clear();
115 pitch_histogram_.Clear();
116 image_width_ = 0;
117 image_height_ = 0;
118 memset(k_mat_, 0.0f, sizeof(float) * 9);
119 pitch_cur_ = 0.0f;
120 pitch_estimation_ = 0.0f;
121 vanishing_row_ = 0.0f;
122 accumulated_straight_driving_in_meter_ = 0.0f;
123}

◆ get_pitch_estimation()

float apollo::perception::camera::LaneBasedCalibrator::get_pitch_estimation ( ) const
inline

在文件 lane_based_calibrator.h93 行定义.

93{ return pitch_estimation_; }

◆ get_vanishing_row()

float apollo::perception::camera::LaneBasedCalibrator::get_vanishing_row ( ) const
inline

在文件 lane_based_calibrator.h99 行定义.

99{ return vanishing_row_; }

◆ Init()

void apollo::perception::camera::LaneBasedCalibrator::Init ( const LocalCalibratorInitOptions options,
const CalibratorParams params = nullptr 
)

在文件 lane_based_calibrator.cc93 行定义.

94 {
95 ClearUp();
96 image_width_ = options.image_width;
97 image_height_ = options.image_height;
98 assert(image_width_ > 0);
99 assert(image_height_ > 0);
100 k_mat_[0] = options.focal_x;
101 k_mat_[4] = options.focal_y;
102 k_mat_[2] = options.cx;
103 k_mat_[5] = options.cy;
104 k_mat_[1] = k_mat_[3] = k_mat_[6] = k_mat_[7] = 0.0f;
105 k_mat_[8] = 1.0f;
106
107 if (params != nullptr) {
108 params_ = *params;
109 }
110 pitch_histogram_.Init(&params_.hist_estimator_params);
111}
void Init(const HistogramEstimatorParams *params=nullptr)

◆ Process()

bool apollo::perception::camera::LaneBasedCalibrator::Process ( const EgoLane lane,
const float &  velocity,
const float &  yaw_rate,
const float &  time_diff 
)

在文件 lane_based_calibrator.cc125 行定义.

127 {
128 float distance_traveled_in_meter = velocity * time_diff;
129 float vehicle_yaw_changed = yaw_rate * time_diff;
130
131 // distance_traveled_in_meter = 0.5f; // hardcode for debug
132
133 // TODO(Xun): Change cout or cerr to log.
134
135 // Check for driving straight
136 if (!IsTravelingStraight(vehicle_yaw_changed)) {
137 AINFO << "Do not calibate if not moving straight: "
138 << "yaw angle changed " << vehicle_yaw_changed;
139 vp_buffer_.clear();
140 return false;
141 }
142
143 VanishingPoint vp_cur;
144 VanishingPoint vp_work;
145
146 // Get the current estimation on vanishing point from lane
147 if (!GetVanishingPoint(lane, &vp_cur)) {
148 AINFO << "Lane is not valid for calibration.";
149 return false;
150 }
151 vp_cur.distance_traveled = distance_traveled_in_meter;
152 // std::cout << "#current v-row: " << vp_cur.pixel_pos[1] << std::endl;
153
154 // Push vanishing point into buffer
155 PushVanishingPoint(vp_cur);
156 if (!PopVanishingPoint(&vp_work)) {
157 AINFO << "Driving distance is not long enough";
158 return false;
159 }
160
161 // Get current estimation on pitch
162 pitch_cur_ = 0.0f;
163 if (!GetPitchFromVanishingPoint(vp_work, &pitch_cur_)) {
164 AINFO << "Failed to estimate pitch from vanishing point.";
165 return false;
166 }
167 // std::cout << "#current pitch: " << pitch_cur_ << std::endl;
168 vanishing_row_ = vp_work.pixel_pos[1];
169
170 // Get the filtered output using histogram
171 if (!AddPitchToHistogram(pitch_cur_)) {
172 AINFO << "Calculated pitch is out-of-range.";
173 return false;
174 }
175
176 accumulated_straight_driving_in_meter_ += distance_traveled_in_meter;
177 // std::cout << "acc_d: " << accumulated_straight_driving_in_meter_ << "\n";
178 if (accumulated_straight_driving_in_meter_ >
180 pitch_histogram_.Process()) {
181 pitch_estimation_ = pitch_histogram_.get_val_estimation();
182 const float cy = k_mat_[5];
183 const float fy = k_mat_[4];
184 vanishing_row_ = tanf(pitch_estimation_) * fy + cy;
185 accumulated_straight_driving_in_meter_ = 0.0f;
186 return true;
187 }
188 return false;
189}
#define AINFO
Definition log.h:42

类成员变量说明

◆ kMaxNrHistoryFrames

const int apollo::perception::camera::LaneBasedCalibrator::kMaxNrHistoryFrames = 1000
static

在文件 lane_based_calibrator.h77 行定义.


该类的文档由以下文件生成: