EasyNav Simple Stack
Loading...
Searching...
No Matches
SimpleMapsManager.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 GNU General Public License v3.0.
5// See <http://www.gnu.org/licenses/> for details.
6//
7// Easy Navigation program is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19
22
23#ifndef EASYNAV_PLANNER__SIMPLEMAPMANAGER_HPP_
24#define EASYNAV_PLANNER__SIMPLEMAPMANAGER_HPP_
25
26#include <vector>
27#include <stdexcept>
28#include <algorithm>
29#include <utility>
30#include <fstream>
31#include <sstream>
32
33#include "nav_msgs/msg/occupancy_grid.hpp"
34#include "std_srvs/srv/trigger.hpp"
35
36#include "tf2_ros/buffer.h"
37#include "tf2_ros/transform_listener.h"
38
39#include "easynav_core/MapsManagerBase.hpp"
41
42#include "yaets/tracing.hpp"
43
44namespace easynav
45{
46
55class SimpleMapsManager : public easynav::MapsManagerBase
56{
57public:
62
67
75 virtual std::expected<void, std::string> on_initialize() override;
76
85 virtual void update(NavState & nav_state) override;
86
92 void set_static_map(const SimpleMap & new_map);
93
99 void set_dynamic_map(const SimpleMap & new_map);
100
101protected:
105 std::string map_path_;
106
107private:
111 SimpleMap static_map_;
112
116 SimpleMap dynamic_map_;
117
121 rclcpp::Publisher<nav_msgs::msg::OccupancyGrid>::SharedPtr static_occ_pub_;
122
126 rclcpp::Publisher<nav_msgs::msg::OccupancyGrid>::SharedPtr dynamic_occ_pub_;
127
131 rclcpp::Subscription<nav_msgs::msg::OccupancyGrid>::SharedPtr incoming_map_sub_;
132
136 rclcpp::Service<std_srvs::srv::Trigger>::SharedPtr savemap_srv_;
137
141 nav_msgs::msg::OccupancyGrid static_grid_msg_;
142
146 nav_msgs::msg::OccupancyGrid dynamic_grid_msg_;
147};
148
149} // namespace easynav
150
151#endif // EASYNAV_PLANNER__SIMPLEMAPMANAGER_HPP_
Declaration of the SimpleMap type.
Simple 2D uint8_t grid using basic C++ types, with full metric conversion support.
Definition SimpleMap.hpp:46
void set_dynamic_map(const SimpleMap &new_map)
Replaces the current dynamic map.
Definition SimpleMapsManager.cpp:136
virtual void update(NavState &nav_state) override
Updates the internal maps using the current navigation state.
Definition SimpleMapsManager.cpp:142
~SimpleMapsManager()
Destructor.
Definition SimpleMapsManager.cpp:50
void set_static_map(const SimpleMap &new_map)
Replaces the current static map.
Definition SimpleMapsManager.cpp:130
SimpleMapsManager()
Default constructor.
Definition SimpleMapsManager.cpp:39
virtual std::expected< void, std::string > on_initialize() override
Initializes the maps manager.
Definition SimpleMapsManager.cpp:56
std::string map_path_
Full path to the map file.
Definition SimpleMapsManager.hpp:105
Definition SimpleMap.hpp:37