EasyNav Plugins
Loading...
Searching...
No Matches
GpsLocalizer.hpp
Go to the documentation of this file.
1// Copyright 2025 Intelligent Robotics Lab
2//
3// This file is part of the project Easy Navigation (EasyNav in short)
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
18
19#ifndef EASYNAV_LOCALIZER__GPSLOCALIZER_HPP_
20#define EASYNAV_LOCALIZER__GPSLOCALIZER_HPP_
21
22#include "nav_msgs/msg/odometry.hpp"
23#include "sensor_msgs/msg/nav_sat_fix.hpp"
24#include "easynav_core/LocalizerMethodBase.hpp"
25#include "tf2_ros/static_transform_broadcaster.hpp"
26#include "sensor_msgs/msg/imu.hpp"
27#include <GeographicLib/UTMUPS.hpp>
28
29namespace easynav
30{
31
40class GpsLocalizer : public easynav::LocalizerMethodBase
41{
42public:
46 GpsLocalizer() = default;
47
51 ~GpsLocalizer() = default;
52
60 virtual void on_initialize() override;
61
72 virtual void update_rt(NavState & nav_state) override;
73
84 virtual void update(NavState & nav_state) override;
85
86private:
92 nav_msgs::msg::Odometry odom_;
93
100 geometry_msgs::msg::Point origin_utm_;
101
108 rclcpp::Publisher<nav_msgs::msg::Odometry>::SharedPtr odom_pub_;
109
116 rclcpp::Subscription<sensor_msgs::msg::NavSatFix>::SharedPtr gps_subscriber_;
117
125 rclcpp::Subscription<sensor_msgs::msg::Imu>::SharedPtr imu_subscriber_;
126
133 sensor_msgs::msg::NavSatFix gps_msg_;
134
141 sensor_msgs::msg::Imu imu_msg_;
142
149 std::shared_ptr<tf2_ros::StaticTransformBroadcaster> static_broadcaster_;
150
159 void gps_callback(const sensor_msgs::msg::NavSatFix::SharedPtr msg);
160
169 void imu_callback(const sensor_msgs::msg::Imu::SharedPtr msg);
170
171 double alpha_, dt_, yaw_1_, time_1_;
172};
173
174} // namespace easynav
175
176#endif // EASYNAV_LOCALIZER__GPSLOCALIZER_HPP_
virtual void update(NavState &nav_state) override
Updates the localization estimate based on the current navigation state.
Definition GpsLocalizer.cpp:89
virtual void update_rt(NavState &nav_state) override
Updates the localization estimate based on the current navigation state.
Definition GpsLocalizer.cpp:85
~GpsLocalizer()=default
Default destructor.
virtual void on_initialize() override
Initialize the localization method.
Definition GpsLocalizer.cpp:26
GpsLocalizer()=default
Default constructor.
Provides a mapping for often used cost values.
Definition cost_values.hpp:41