Apollo 10.0
自动驾驶开放平台
rtk_localization_component.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 <string>
21
22#include "Eigen/Eigen"
23// Eigen 3.3.7: #define ALIVE (0)
24// fastrtps: enum ChangeKind_t { ALIVE, ... };
25#if defined(ALIVE)
26#undef ALIVE
27#endif
28
29#include "modules/common_msgs/localization_msgs/gps.pb.h"
30#include "modules/common_msgs/localization_msgs/imu.pb.h"
31#include "modules/common_msgs/localization_msgs/localization.pb.h"
32#include "modules/common_msgs/sensor_msgs/ins.pb.h"
33#include "modules/localization/proto/rtk_config.pb.h"
34
37#include "cyber/cyber.h"
41
42namespace apollo {
43namespace localization {
44
46 : public cyber::Component<localization::Gps> {
47 public:
50
51 bool Init() override;
52
53 bool Proc(const std::shared_ptr<localization::Gps> &gps_msg) override;
54
55 private:
56 bool InitConfig();
57 bool InitIO();
58 bool GetLocalizationToImuTF();
59 void CompensateImuLocalizationExtrinsic(LocalizationEstimate *localization);
60
61 void PublishPoseBroadcastTF(const LocalizationEstimate &localization);
62 void PublishPoseBroadcastTopic(const LocalizationEstimate &localization);
63 void PublishLocalizationStatus(const LocalizationStatus &localization_status);
64
65 private:
66 std::shared_ptr<cyber::Reader<localization::CorrectedImu>>
67 corrected_imu_listener_ = nullptr;
68 std::shared_ptr<cyber::Reader<drivers::gnss::InsStat>> gps_status_listener_ =
69 nullptr;
70
71 std::shared_ptr<cyber::Writer<LocalizationEstimate>> localization_talker_ =
72 nullptr;
73 std::shared_ptr<cyber::Writer<LocalizationStatus>>
74 localization_status_talker_ = nullptr;
75
76 std::string localization_topic_ = "";
77 std::string localization_status_topic_ = "";
78 std::string gps_topic_ = "";
79 std::string gps_status_topic_ = "";
80 std::string imu_topic_ = "";
81
82 std::string broadcast_tf_frame_id_ = "";
83 std::string broadcast_tf_child_frame_id_ = "";
84 std::string imu_frame_id_ = "";
85 std::unique_ptr<apollo::transform::TransformBroadcaster> tf2_broadcaster_;
86
87 // transform from localization to imu
88 std::unique_ptr<Eigen::Quaterniond> imu_localization_quat_;
89 std::unique_ptr<Eigen::Vector3d> imu_localization_translation_;
90
91 std::unique_ptr<RTKLocalization> localization_;
92};
93
95
96} // namespace localization
97} // namespace apollo
bool Proc(const std::shared_ptr< localization::Gps > &gps_msg) override
#define CYBER_REGISTER_COMPONENT(name)
Definition component.h:656
class register implement
Definition arena_queue.h:37