Apollo 11.0
自动驾驶开放平台
data_parser.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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 <memory>
20#include <mutex>
21#include <string>
22
23#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
24#include <proj_api.h>
25
26#include "modules/common_msgs/localization_msgs/gps.pb.h"
27#include "modules/common_msgs/localization_msgs/imu.pb.h"
28#include "modules/common_msgs/sensor_msgs/gnss.pb.h"
29#include "modules/common_msgs/sensor_msgs/gnss_best_pose.pb.h"
30#include "modules/common_msgs/sensor_msgs/gnss_raw_observation.pb.h"
31#include "modules/common_msgs/sensor_msgs/heading.pb.h"
32#include "modules/common_msgs/sensor_msgs/imu.pb.h"
33#include "modules/common_msgs/sensor_msgs/ins.pb.h"
34#include "modules/drivers/gnss/proto/config.pb.h"
35#include "modules/drivers/gnss/proto/gnss_status.pb.h"
36
37#include "cyber/cyber.h"
40
41namespace apollo {
42namespace drivers {
43namespace gnss {
44
46 public:
47 DataParser(const config::Config &config,
48 const std::shared_ptr<apollo::cyber::Node> &node);
50 bool Init();
51 void ParseRawData(const std::string &msg, const uint8_t &channel = 0);
52
53 private:
54 void DispatchMessage(const MessageInfo &message_info);
55 void PublishInsStat(const MessagePtr message);
56 void PublishOdometry(const MessagePtr message);
57 void PublishCorrimu(const MessagePtr message);
58 void PublishImu(const MessagePtr message);
59 void PublishBestpos(const MessagePtr message);
60 void PublishEphemeris(const MessagePtr message);
61 void PublishObservation(const MessagePtr message);
62 void PublishHeading(const MessagePtr message);
63 void CheckInsStatus(Ins *ins);
64 void CheckGnssStatus(Gnss *gnss);
65 void GpsToTransformStamped(
66 const std::shared_ptr<apollo::localization::Gps> &gps,
68
69 bool init_flag_ = false;
70 config::Config config_;
71 std::unique_ptr<Parser> data_parser_;
73
74 GnssStatus gnss_status_;
75 InsStatus ins_status_;
76 uint32_t ins_status_record_ = static_cast<uint32_t>(0);
77 projPJ wgs84pj_source_;
78 projPJ utm_target_;
79 bool has_ins_stat_message_ = false;
80
81 std::shared_ptr<apollo::cyber::Node> node_ = nullptr;
82 std::shared_ptr<apollo::cyber::Writer<GnssStatus>> gnssstatus_writer_ =
83 nullptr;
84 std::shared_ptr<apollo::cyber::Writer<InsStatus>> insstatus_writer_ = nullptr;
85 std::shared_ptr<apollo::cyber::Writer<GnssBestPose>> gnssbestpose_writer_ =
86 nullptr;
87 std::shared_ptr<apollo::cyber::Writer<apollo::localization::CorrectedImu>>
88 corrimu_writer_ = nullptr;
89 std::shared_ptr<apollo::cyber::Writer<Imu>> rawimu_writer_ = nullptr;
90 std::shared_ptr<apollo::cyber::Writer<apollo::localization::Gps>>
91 gps_writer_ = nullptr;
92 std::shared_ptr<apollo::cyber::Writer<InsStat>> insstat_writer_ = nullptr;
93 std::shared_ptr<apollo::cyber::Writer<GnssEphemeris>> gnssephemeris_writer_ =
94 nullptr;
95 std::shared_ptr<apollo::cyber::Writer<EpochObservation>>
96 epochobservation_writer_ = nullptr;
97 std::shared_ptr<apollo::cyber::Writer<Heading>> heading_writer_ = nullptr;
98
99 std::mutex data_mutex_;
100};
101
102} // namespace gnss
103} // namespace drivers
104} // namespace apollo
void ParseRawData(const std::string &msg, const uint8_t &channel=0)
This class provides an easy way to publish coordinate frame transform information.
::google::protobuf::Message * MessagePtr
Definition parser.h:34
class register implement
Definition arena_queue.h:37