Apollo  6.0
Open source self driving car software
online_localization_expert.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 #pragma once
18 
19 #include "localization_msf/sins_struct.h"
20 #include "modules/drivers/gnss/proto/gnss_best_pose.pb.h"
22 #include "modules/localization/proto/localization.pb.h"
23 #include "modules/localization/proto/localization_status.pb.h"
24 
29 namespace apollo {
30 namespace localization {
31 namespace msf {
32 
34  public:
35  OnlineLocalizationExpert() = default;
36  ~OnlineLocalizationExpert() = default;
37 
38  bool Init(const LocalizationIntegParam &param);
39 
40  void AddImu(const ImuData &data);
41  void AddFusionLocalization(const LocalizationEstimate &data);
42  void AddLidarLocalization(const LocalizationEstimate &data);
43  void AddGnssBestPose(const drivers::gnss::GnssBestPose &msg,
44  const MeasureData &data);
45 
46  void GetFusionStatus(MsfStatus *msf_status, MsfSensorMsgStatus *sensor_status,
47  LocalizationIntegStatus *integstatus);
48  void GetGnssStatus(MsfStatus *msf_status);
49 
50  private:
51  void CheckImuDelayStatus(const double &cur_imu_time);
52  void CheckImuMissingStatus(const double &cur_imu_time);
53  void CheckGnssLidarMsfStatus(const double &cur_imu_time);
54  void SetLocalizationStatus(const LocalizationEstimate &data);
55 
56  private:
57  MsfStatus msf_status_;
58  std::mutex msf_status_mutex_;
59 
60  MsfSensorMsgStatus sensor_status_;
61 
62  double latest_gnsspos_timestamp_ = 0.0;
63  std::mutex latest_gnsspos_timestamp_mutex_;
64 
65  double latest_lidar_timestamp_ = 0.0;
66  std::mutex latest_lidar_timestamp_mutex_;
67 
68  double imu_delay_time_threshold_1_ = 0.1;
69  double imu_delay_time_threshold_2_ = 0.05;
70  double imu_delay_time_threshold_3_ = 0.02;
71 
72  double imu_missing_time_threshold_1_ = 0.1;
73  double imu_missing_time_threshold_2_ = 0.05;
74  double imu_missing_time_threshold_3_ = 0.01;
75 
76  double bestgnsspose_loss_time_threshold_ = 2.0;
77  double lidar_loss_time_threshold_ = 2.0;
78 
79  double localization_std_x_threshold_1_ = 0.15;
80  double localization_std_y_threshold_1_ = 0.15;
81 
82  double localization_std_x_threshold_2_ = 0.3;
83  double localization_std_y_threshold_2_ = 0.3;
84 
85  LocalizationIntegStatus integ_status_;
86 };
87 
88 } // namespace msf
89 } // namespace localization
90 } // namespace apollo
void GetFusionStatus(MsfStatus *msf_status, MsfSensorMsgStatus *sensor_status, LocalizationIntegStatus *integstatus)
void AddLidarLocalization(const LocalizationEstimate &data)
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
void AddGnssBestPose(const drivers::gnss::GnssBestPose &msg, const MeasureData &data)
void AddFusionLocalization(const LocalizationEstimate &data)
The class of LocalizationIntegParam.
Definition: online_localization_expert.h:33
bool Init(const LocalizationIntegParam &param)
Definition: localization_params.h:60
Definition: localization_params.h:124