37 {
38 if (pitch_angle == nullptr) {
39 AERROR <<
"pitch_angle is not available";
40 return false;
41 }
42 EgoLane ego_lane;
43 if (!LoadEgoLaneline(*options.lane_objects, &ego_lane)) {
44 AINFO <<
"Failed to get the ego lane.";
45 return false;
46 }
47
48 double cam_ori[4] = {0};
49 cam_ori[3] = 1.0;
50
51
52 Eigen::Affine3d c2w = *options.camera2world_pose;
53
54 double p2w[12] = {
55 c2w(0, 0), c2w(0, 1), c2w(0, 2), c2w(0, 3), c2w(1, 0), c2w(1, 1),
56 c2w(1, 2), c2w(1, 3), c2w(2, 0), c2w(2, 1), c2w(2, 2), c2w(2, 3),
57 };
58
59 ADEBUG <<
"c2w transform this frame:\n"
60 << p2w[0] << ", " << p2w[1] << ", " << p2w[2] << ", " << p2w[3] << "\n"
61 << p2w[4] << ", " << p2w[5] << ", " << p2w[6] << ", " << p2w[7] << "\n"
62 << p2w[8] << ", " << p2w[9] << ", " << p2w[10] << ", " << p2w[11];
63
68
69 timestamp_cur_ = *options.timestamp;
70 if (!is_first_frame_) {
71 time_diff_ = fabsf(static_cast<float>(timestamp_cur_ - timestamp_pre_));
72 ADEBUG << timestamp_cur_ <<
" " << timestamp_pre_ << std::endl;
74 cam_coord_pre_pre_, &yaw_rate_, &velocity_);
75 std::string timediff_yawrate_velocity_text =
76 absl::StrCat("time_diff_: ", std::to_string(time_diff_).substr(0, 4),
77 " | yaw_rate_: ", std::to_string(yaw_rate_).substr(0, 4),
78 " | velocity_: ", std::to_string(velocity_).substr(0, 4));
79 ADEBUG << timediff_yawrate_velocity_text << std::endl;
80 }
81
82 bool updated =
83 calibrator_.
Process(ego_lane, velocity_, yaw_rate_, time_diff_);
84 if (updated) {
87 AINFO <<
"#updated pitch angle: " << *pitch_angle;
88 AINFO <<
"#vanishing row: " << vanishing_row;
89 }
90
91 if (!is_first_frame_) {
92 memcpy(cam_coord_pre_pre_, cam_coord_pre_, sizeof(double) * 3);
93 }
94 is_first_frame_ = false;
95 memcpy(cam_coord_pre_, cam_coord_cur_, sizeof(double) * 3);
96 timestamp_pre_ = timestamp_cur_;
97 return updated;
98}
float get_pitch_estimation() const
bool Process(const EgoLane &lane, const float &velocity, const float &yaw_rate, const float &time_diff)
float get_vanishing_row() const
void IMultAx3x4(const T A[12], const T x[4], T Ax[3])
const float kVelocityDefault
const float kYawRateDefault
const float kTimeDiffDefault
void GetYawVelocityInfo(const float &time_diff, const double cam_coord_cur[3], const double cam_coord_pre[3], const double cam_coord_pre_pre[3], float *yaw_rate, float *velocity)