Apollo 11.0
自动驾驶开放平台
localization_gnss_process.h
浏览该文件的文档.
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
22#pragma once
23
24#include <map>
25
26#include "Eigen/Core"
27#include "Eigen/Geometry"
28
29#include "localization_msf/gnss_solver.h"
31#include "modules/common_msgs/sensor_msgs/gnss_raw_observation.pb.h"
33
38namespace apollo {
39namespace localization {
40namespace msf {
41
42union LeverArm {
43 double arm[3];
44 struct {
45 double arm_x;
46 double arm_y;
47 double arm_z;
48 };
49};
50
51struct EphKey {
53 unsigned int sat_prn;
54 // toe = eph.toe + eph.week_num * sec_per_week
55 double eph_toe;
56 static const int second_per_week = 604800;
57 EphKey(const apollo::drivers::gnss::GnssType type, const unsigned int prn,
58 double toe) {
59 gnss_type = type;
60 sat_prn = prn;
61 eph_toe = toe;
62 }
63 EphKey(const apollo::drivers::gnss::GnssType type, const unsigned int prn,
64 const unsigned int week_num, double toe) {
65 gnss_type = type;
66 sat_prn = prn;
67 eph_toe = toe + week_num * second_per_week;
68 }
74 bool operator<(const EphKey &key2) const {
75 if (gnss_type < key2.gnss_type) {
76 return true;
77 }
78 if (gnss_type == key2.gnss_type) {
79 if (sat_prn < key2.sat_prn) {
80 return true;
81 }
82 if (sat_prn == key2.sat_prn) {
83 return eph_toe < key2.eph_toe;
84 }
85 return false;
86 }
87 return false;
88 }
89 bool operator==(const EphKey &key2) const {
90 return (gnss_type == key2.gnss_type) && (sat_prn == key2.sat_prn) &&
91 (eph_toe == key2.eph_toe);
92 }
93 EphKey &operator=(const EphKey &key2) {
94 gnss_type = key2.gnss_type;
95 sat_prn = key2.sat_prn;
96 eph_toe = key2.eph_toe;
97 return *this;
98 }
99};
100
102 public:
106 // callback function for rostopic
107 // raw data' field "receiver_id" differs rover (= 0) from baser (= 1)
110 void IntegSinsPvaProcess(const InsPva &sins_pva, const double variance[9][9]);
111 LocalizationMeasureState GetResult(MeasureData *gnss_measure);
112
113 private:
114 void SetDefaultOption();
115 // bool LoadHistoryEph(const std::string &nav_file);
116 bool DuplicateEph(const drivers::gnss::GnssEphemeris &raw_eph);
117
118 inline void LogPnt(const GnssPntResultMsg &rover_pnt, double ratio);
119 bool GnssPosition(EpochObservationMsg *raw_rover_obs);
120
121 private:
122 GnssSolver *gnss_solver_;
123 GnssPntResultMsg gnss_pnt_result_;
124
125 bool enable_ins_aid_rtk_ = true;
126
127 std::map<EphKey, drivers::gnss::GnssEphemeris> map_gnss_eph_;
128
129 // from imu to gnss antenna
130 LeverArm gnss_lever_arm_;
131 // integrated-ins indicator
132 bool sins_align_finish_ = false;
133
134 // deploy simple short-baseline to resolve heading
135 GnssSolver *double_antenna_solver_;
136
137 // newest obs time
138 double current_obs_time_ = 0.0;
139
140 LocalizationMeasureState gnss_state_;
141};
142
143} // namespace msf
144} // namespace localization
145} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
void RawObservationProcess(const drivers::gnss::EpochObservation &raw_obs)
void RawEphemerisProcess(const drivers::gnss::GnssEphemeris &gnss_orbit)
apollo::common::Status Init(const LocalizationIntegParam &param)
LocalizationMeasureState GetResult(MeasureData *gnss_measure)
void IntegSinsPvaProcess(const InsPva &sins_pva, const double variance[9][9])
The class of LocalizationIntegParam
class register implement
Definition arena_queue.h:37
bool operator==(const EphKey &key2) const
EphKey(const apollo::drivers::gnss::GnssType type, const unsigned int prn, const unsigned int week_num, double toe)
apollo::drivers::gnss::GnssType gnss_type
bool operator<(const EphKey &key2) const
EphKey(const apollo::drivers::gnss::GnssType type, const unsigned int prn, double toe)