Apollo  6.0
Open source self driving car software
localization_integ_process.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 <queue>
20 #include <string>
21 
22 #include "Eigen/Core"
23 #include "Eigen/Geometry"
24 #include "cyber/cyber.h"
25 
26 #include "localization_msf/sins.h"
29 #include "modules/localization/proto/localization.pb.h"
30 
35 namespace apollo {
36 namespace localization {
37 namespace msf {
38 
39 enum class IntegState { NOT_INIT = 0, NOT_STABLE, OK, VALID };
40 
48  public:
50 
53 
54  // Initialization.
56 
57  // Raw Imu process.
58  void RawImuProcess(const ImuData &imu_msg);
59  void GetState(IntegState *state);
60  void GetResult(IntegState *state, LocalizationEstimate *localization);
61  void GetResult(IntegState *state, InsPva *sins_pva,
62  double pva_covariance[9][9]);
63  void GetCorrectedImu(ImuData *imu_data);
64  void GetEarthParameter(InertialParameter *earth_param);
65 
66  // itegration measure data process
67  void MeasureDataProcess(const MeasureData &measure_msg);
68 
69  private:
70  bool CheckIntegMeasureData(const MeasureData &measure_data);
71 
72  bool LoadGnssAntennaExtrinsic(const std::string &file_path,
73  TransformD *extrinsic) const;
74 
75  void MeasureDataProcessImpl(const MeasureData &measure_msg);
76  void MeasureDataThreadLoop();
77  void StartThreadLoop();
78  void StopThreadLoop();
79 
80  void GetValidFromOK();
81 
82  private:
83  Sins *sins_;
84 
85  // config
86  TransformD gnss_antenna_extrinsic_;
87 
88  // double imu_rate_;
89 
90  IntegState integ_state_;
91  InsPva ins_pva_;
92  double pva_covariance_[9][9];
93 
94  ImuData corrected_imu_;
95  InertialParameter earth_param_;
96 
97  std::atomic<bool> keep_running_;
98  std::queue<MeasureData> measure_data_queue_;
99  int measure_data_queue_size_ = 150;
100  std::mutex measure_data_queue_mutex_;
101 
102  int delay_output_counter_ = 0;
103 
104  public:
105  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
106 };
107 
108 } // namespace msf
109 } // namespace localization
110 } // namespace apollo
Eigen::Affine3d TransformD
Definition: localization_integ_process.h:49
IntegState
Definition: localization_integ_process.h:39
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
process Imu msg for localization
Definition: localization_integ_process.h:47
The class of LocalizationIntegParam.
State GetState()
bool Init(const char *binary_name)
Definition: localization_params.h:60
A general class to denote the return status of an API call. It can either be an OK status for success...
Definition: status.h:43
Eigen::Affine3d Affine3d
Definition: base_map_fwd.h:34