• Apollo 应用与源码分析:Monitor监控-硬件监控-GPS


    硬件架构图

    可以看到左下角的“GNSS定位模块”其实是有IMU和GPS Antenna 组成的。

    执行分析

    代码

    1. class GpsMonitor : public RecurrentRunner {
    2. public:
    3. GpsMonitor();
    4. void RunOnce(const double current_time) override;
    5. };
    6. void GpsMonitor::RunOnce(const double current_time) {
    7. auto manager = MonitorManager::Instance();
    8. Component* component = apollo::common::util::FindOrNull(
    9. *manager->GetStatus()->mutable_components(), FLAGS_gps_component_name);
    10. if (component == nullptr) {
    11. // GPS is not monitored in current mode, skip.
    12. return;
    13. }
    14. ComponentStatus* component_status = component->mutable_other_status();
    15. component_status->clear_status();
    16. static auto gnss_best_pose_reader =
    17. manager->CreateReader(FLAGS_gnss_best_pose_topic);
    18. gnss_best_pose_reader->Observe();
    19. const auto gnss_best_pose_status = gnss_best_pose_reader->GetLatestObserved();
    20. if (gnss_best_pose_status == nullptr) {
    21. SummaryMonitor::EscalateStatus(ComponentStatus::ERROR,
    22. "No GnssBestPose message", component_status);
    23. return;
    24. }
    25. switch (gnss_best_pose_status->sol_type()) {
    26. case SolutionType::NARROW_INT:
    27. SummaryMonitor::EscalateStatus(ComponentStatus::OK, "", component_status);
    28. break;
    29. case SolutionType::SINGLE:
    30. SummaryMonitor::EscalateStatus(
    31. ComponentStatus::WARN, "SolutionType is SINGLE", component_status);
    32. break;
    33. default:
    34. SummaryMonitor::EscalateStatus(ComponentStatus::ERROR,
    35. "SolutionType is wrong", component_status);
    36. break;
    37. }
    38. }

    分析

    gps monitor 核心内容就70 line code

    基本思路如下:

    1. 从配置文件中查找GPS是否是被配置的监控组件
    2. 如果是的话,订阅GnssBestPose topic,并收取数据
    3. 获取最新的数据,如果最新的数据为null,发出ERROR级别的故障
    4. 如果获取的数据类型为NARROW_INT,表示正常
    5. 如果获取的数据类型为SINGLE,表示WARN
      1. 这里根据apollo 的定位算法设计与硬件架构,不难猜SINGLE 代表IMU 惯性单元或GPS有一个没有正常输出数据
      2. 如果获取的数据类型为其他情况,表示ERROR

    GnssBestPose 和 SolutionType 的定义都来自 GNSS 驱动。

    modules/drivers/gnss/proto/gnss_best_pose.proto
    
    1. enum SolutionType {
    2. NONE = 0;
    3. FIXEDPOS = 1;
    4. FIXEDHEIGHT = 2;
    5. FLOATCONV = 4;
    6. WIDELANE = 5;
    7. NARROWLANE = 6;
    8. DOPPLER_VELOCITY = 8;
    9. SINGLE = 16;
    10. PSRDIFF = 17;
    11. WAAS = 18;
    12. PROPOGATED = 19;
    13. OMNISTAR = 20;
    14. L1_FLOAT = 32;
    15. IONOFREE_FLOAT = 33;
    16. NARROW_FLOAT = 34;
    17. L1_INT = 48;
    18. WIDE_INT = 49;
    19. NARROW_INT = 50;
    20. RTK_DIRECT_INS =
    21. 51; // RTK filter is directly initialized from the INS filter.
    22. INS_SBAS = 52;
    23. INS_PSRSP = 53;
    24. INS_PSRDIFF = 54;
    25. INS_RTKFLOAT = 55;
    26. INS_RTKFIXED = 56;
    27. INS_OMNISTAR = 57;
    28. INS_OMNISTAR_HP = 58;
    29. INS_OMNISTAR_XP = 59;
    30. OMNISTAR_HP = 64;
    31. OMNISTAR_XP = 65;
    32. PPP_CONVERGING = 68;
    33. PPP = 69;
    34. INS_PPP_CONVERGING = 73;
    35. INS_PPP = 74;
    36. }

     

  • 相关阅读:
    力扣(LeetCode)2652. 倍数求和(C++)
    win11安装ubuntu(by wsl2)
    从零开始编写自己的 C++ 软渲染器(一) 线与三角形的绘制
    敏稳融合时代,云原生PaaS是企业IT转型的“灵药”吗?
    Latex中公式输入
    每日一道Java面试题:方法重载与方法重写,这把指定让你明明白白!
    首发丨全球首款用于激光雷达的商用光控超表面芯片发布!激光雷达降本再添可选项
    CIE A-Level化学Paper 1真题讲解(5)
    公网集群对讲+GPS可视追踪|助力物流行业智能化管理调度
    【时时三省】(C语言基础)操作符5
  • 原文地址:https://blog.csdn.net/qq_32378713/article/details/128065907