Apollo  6.0
Open source self driving car software
data_parser.h
Go to the documentation of this file.
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 <string>
21 
22 #define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
23 #include <proj_api.h>
24 
25 #include "cyber/cyber.h"
27 
28 #include "modules/drivers/gnss/proto/config.pb.h"
29 #include "modules/drivers/gnss/proto/gnss.pb.h"
30 #include "modules/drivers/gnss/proto/gnss_best_pose.pb.h"
31 #include "modules/drivers/gnss/proto/gnss_raw_observation.pb.h"
32 #include "modules/drivers/gnss/proto/gnss_status.pb.h"
33 #include "modules/drivers/gnss/proto/heading.pb.h"
34 #include "modules/drivers/gnss/proto/imu.pb.h"
35 #include "modules/drivers/gnss/proto/ins.pb.h"
36 #include "modules/localization/proto/gps.pb.h"
37 #include "modules/localization/proto/imu.pb.h"
38 
40 
41 namespace apollo {
42 namespace drivers {
43 namespace gnss {
44 
45 class DataParser {
46  public:
47  using MessagePtr = ::google::protobuf::Message *;
48  DataParser(const config::Config &config,
49  const std::shared_ptr<apollo::cyber::Node> &node);
51  bool Init();
52  void ParseRawData(const std::string &msg);
53 
54  private:
55  void DispatchMessage(Parser::MessageType type, MessagePtr message);
56  void PublishInsStat(const MessagePtr message);
57  void PublishOdometry(const MessagePtr message);
58  void PublishCorrimu(const MessagePtr message);
59  void PublishImu(const MessagePtr message);
60  void PublishBestpos(const MessagePtr message);
61  void PublishEphemeris(const MessagePtr message);
62  void PublishObservation(const MessagePtr message);
63  void PublishHeading(const MessagePtr message);
64  void CheckInsStatus(Ins *ins);
65  void CheckGnssStatus(Gnss *gnss);
66  void GpsToTransformStamped(
67  const std::shared_ptr<apollo::localization::Gps> &gps,
68  apollo::transform::TransformStamped *transform);
69 
70  bool init_flag_ = false;
71  config::Config config_;
72  std::unique_ptr<Parser> data_parser_;
74 
75  GnssStatus gnss_status_;
76  InsStatus ins_status_;
77  uint32_t ins_status_record_ = static_cast<uint32_t>(0);
78  projPJ wgs84pj_source_;
79  projPJ utm_target_;
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 
100 } // namespace gnss
101 } // namespace drivers
102 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
MessageType
Definition: parser.h:75
DataParser(const config::Config &config, const std::shared_ptr< apollo::cyber::Node > &node)
~DataParser()
Definition: data_parser.h:50
InsStatus
Definition: novatel_messages.h:393
Definition: data_parser.h:45
void ParseRawData(const std::string &msg)
This class provides an easy way to publish coordinate frame transform information. It will handle all the messaging and stuffing of messages. And the function prototypes lay out all the necessary data needed for each message.
Definition: transform_broadcaster.h:34
::google::protobuf::Message * MessagePtr
Definition: data_parser.h:47