Apollo 10.0
自动驾驶开放平台
apollo::localization::LocalizationGnssCompensator类 参考

#include <gnss_compensator.h>

apollo::localization::LocalizationGnssCompensator 的协作图:

Public 成员函数

 ~LocalizationGnssCompensator ()
 
void ProcessCompensation (const uint64_t &current_send_tf_time, uint64_t *measurement_time)
 compensate the time parsed from invalid GNSS data
 

详细描述

在文件 gnss_compensator.h26 行定义.

构造及析构函数说明

◆ ~LocalizationGnssCompensator()

apollo::localization::LocalizationGnssCompensator::~LocalizationGnssCompensator ( )

在文件 gnss_compensator.cc25 行定义.

25{}

成员函数说明

◆ ProcessCompensation()

void apollo::localization::LocalizationGnssCompensator::ProcessCompensation ( const uint64_t &  current_send_tf_time,
uint64_t *  measurement_time 
)

compensate the time parsed from invalid GNSS data

参数
current_send_tf_timethe time of sending tf msg
measurement_timeGNSS data measurement time

在文件 gnss_compensator.cc27 行定义.

28 {
29 // Sometimes GNSS does not return valid timestamp
30 // The following logic is to compensate the invalid timestamp of GNSS
31 // we use 3 variables to make this compensation
32 // last_valid_gnss_time_: Time parsed from last valid GNSS data
33 // last_send_tf_time_: Time of the last tf sent
34 // last_compensated_gnss_time_: Time of compensated gnss time
35 uint64_t compensated_delta;
36 if (last_valid_gnss_time_ != 0 && last_send_tf_time_ != 0) {
37 // calculate delta
38 compensated_delta = current_send_tf_time - last_send_tf_time_;
39 // If exceed the tolerance range and the measurement time
40 // is less than or equal to the last valid GNSS time, the
41 // GNSS data is considered invalid.
42 if (compensated_delta >=
43 static_cast<uint64_t>(FLAGS_gps_imu_compensate_ns_tolerance) &&
44 *measurement_time <= last_valid_gnss_time_) {
45 // Record the time of compensation for use in case
46 // the next GNSS data is also invalid
47 last_compensated_gnss_time_ =
48 last_compensated_gnss_time_+ compensated_delta;
49 AINFO << "enter compensator: " << "last valid gnss time: " <<
50 last_valid_gnss_time_ << ", " << "measurement time: " <<
51 *measurement_time << ", " << "measurement time after compensated: " <<
52 last_compensated_gnss_time_;
53 // only compensate when the flag is true
54 if (FLAGS_enable_gps_imu_compensate)
55 *measurement_time = last_compensated_gnss_time_;
56 } else {
57 // If the GNSS data is valid, simply record it
58 last_valid_gnss_time_ = *measurement_time;
59 last_compensated_gnss_time_ = *measurement_time;
60 }
61 } else {
62 // Initialize
63 last_valid_gnss_time_ = *measurement_time;
64 last_compensated_gnss_time_ = *measurement_time;
65 }
66 last_send_tf_time_ = current_send_tf_time;
67}
#define AINFO
Definition log.h:42

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