NavMap
Loading...
Searching...
No Matches
navmap_io.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
16
17#ifndef NAVMAP_ROS__NAVMAP_IO_HPP_
18#define NAVMAP_ROS__NAVMAP_IO_HPP_
19
39
40#include <string>
41#include <system_error>
42
44
45#include "navmap_ros_interfaces/msg/nav_map.hpp"
46
51namespace navmap_ros::io
52{
53
55enum class Compression { NONE, ZLIB };
56
65
80 const navmap_ros_interfaces::msg::NavMap & msg,
81 const std::string & path,
82 const SaveOptions & options = {},
83 std::error_code * ec = nullptr);
84
97 const std::string & path,
98 navmap_ros_interfaces::msg::NavMap & out_msg,
99 std::error_code * ec = nullptr);
100
114bool save_to_file(
115 const navmap::NavMap & map,
116 const std::string & path,
117 const SaveOptions & options = {},
118 std::error_code * ec = nullptr);
119
132bool load_from_file(
133 const std::string & path,
134 navmap::NavMap & out_map,
135 std::error_code * ec = nullptr);
136
137} // namespace navmap_ros::io
138
139#endif // NAVMAP_ROS__NAVMAP_IO_HPP_
Core container and data structures for EasyNav navigable meshes.
Definition NavMap.hpp:561
IO helpers to persist NavMap objects to/from disk.
Compression
Payload compression. zlib is available on every ROS distro and platform, and in Python.
Definition navmap_io.hpp:55
@ ZLIB
Definition navmap_io.hpp:55
@ NONE
Definition navmap_io.hpp:55
bool load_msg_from_file(const std::string &path, navmap_ros_interfaces::msg::NavMap &out_msg, std::error_code *ec=nullptr)
Load a NavMap message from a file created by this saver.
Definition navmap_io.cpp:152
bool save_to_file(const navmap::NavMap &map, const std::string &path, const SaveOptions &options={}, std::error_code *ec=nullptr)
Save a navmap::NavMap by converting it to a message and serializing to disk.
Definition navmap_io.cpp:244
bool load_from_file(const std::string &path, navmap::NavMap &out_map, std::error_code *ec=nullptr)
Load a navmap::NavMap by deserializing a message and converting to core.
Definition navmap_io.cpp:254
bool save_msg_to_file(const navmap_ros_interfaces::msg::NavMap &msg, const std::string &path, const SaveOptions &options={}, std::error_code *ec=nullptr)
Save a NavMap message to disk using ROS 2 CDR serialization.
Definition navmap_io.cpp:56
Save options.
Definition navmap_io.hpp:59
bool binary
Unused (always binary CDR); kept for source compatibility.
Definition navmap_io.hpp:61
Compression compression
Definition navmap_io.hpp:62
int level
zlib level, 1 (fast) to 9 (small)
Definition navmap_io.hpp:63