
可以看到左下角的“GNSS定位模块”其实是有IMU和GPS Antenna 组成的。
- class GpsMonitor : public RecurrentRunner {
- public:
- GpsMonitor();
- void RunOnce(const double current_time) override;
- };
-
- void GpsMonitor::RunOnce(const double current_time) {
- auto manager = MonitorManager::Instance();
- Component* component = apollo::common::util::FindOrNull(
- *manager->GetStatus()->mutable_components(), FLAGS_gps_component_name);
- if (component == nullptr) {
- // GPS is not monitored in current mode, skip.
- return;
- }
- ComponentStatus* component_status = component->mutable_other_status();
- component_status->clear_status();
-
- static auto gnss_best_pose_reader =
- manager->CreateReader
(FLAGS_gnss_best_pose_topic); - gnss_best_pose_reader->Observe();
- const auto gnss_best_pose_status = gnss_best_pose_reader->GetLatestObserved();
- if (gnss_best_pose_status == nullptr) {
- SummaryMonitor::EscalateStatus(ComponentStatus::ERROR,
- "No GnssBestPose message", component_status);
- return;
- }
- switch (gnss_best_pose_status->sol_type()) {
- case SolutionType::NARROW_INT:
- SummaryMonitor::EscalateStatus(ComponentStatus::OK, "", component_status);
- break;
- case SolutionType::SINGLE:
- SummaryMonitor::EscalateStatus(
- ComponentStatus::WARN, "SolutionType is SINGLE", component_status);
- break;
- default:
- SummaryMonitor::EscalateStatus(ComponentStatus::ERROR,
- "SolutionType is wrong", component_status);
- break;
- }
- }
gps monitor 核心内容就70 line code
基本思路如下:
GnssBestPose 和 SolutionType 的定义都来自 GNSS 驱动。
modules/drivers/gnss/proto/gnss_best_pose.proto
- enum SolutionType {
- NONE = 0;
- FIXEDPOS = 1;
- FIXEDHEIGHT = 2;
- FLOATCONV = 4;
- WIDELANE = 5;
- NARROWLANE = 6;
- DOPPLER_VELOCITY = 8;
- SINGLE = 16;
- PSRDIFF = 17;
- WAAS = 18;
- PROPOGATED = 19;
- OMNISTAR = 20;
- L1_FLOAT = 32;
- IONOFREE_FLOAT = 33;
- NARROW_FLOAT = 34;
- L1_INT = 48;
- WIDE_INT = 49;
- NARROW_INT = 50;
- RTK_DIRECT_INS =
- 51; // RTK filter is directly initialized from the INS filter.
- INS_SBAS = 52;
- INS_PSRSP = 53;
- INS_PSRDIFF = 54;
- INS_RTKFLOAT = 55;
- INS_RTKFIXED = 56;
- INS_OMNISTAR = 57;
- INS_OMNISTAR_HP = 58;
- INS_OMNISTAR_XP = 59;
- OMNISTAR_HP = 64;
- OMNISTAR_XP = 65;
- PPP_CONVERGING = 68;
- PPP = 69;
- INS_PPP_CONVERGING = 73;
- INS_PPP = 74;
- }