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
60{
62 bool binary{true};
63};
64
79 const navmap_ros_interfaces::msg::NavMap & msg,
80 const std::string & path,
81 const SaveOptions & options = {},
82 std::error_code * ec = nullptr);
83
96 const std::string & path,
97 navmap_ros_interfaces::msg::NavMap & out_msg,
98 std::error_code * ec = nullptr);
99
113bool save_to_file(
114 const navmap::NavMap & map,
115 const std::string & path,
116 const SaveOptions & options = {},
117 std::error_code * ec = nullptr);
118
131bool load_from_file(
132 const std::string & path,
133 navmap::NavMap & out_map,
134 std::error_code * ec = nullptr);
135
136} // namespace navmap_ros::io
137
138#endif // NAVMAP_ROS__NAVMAP_IO_HPP_
Core container and data structures for EasyNav navigable meshes.
Main container for navigable surfaces, geometry, and layers.
Definition NavMap.hpp:465
IO helpers to persist NavMap objects to/from disk.
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:87
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:142
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:152
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:48
Save options.
Definition navmap_io.hpp:60
bool binary
If true, save in binary (CDR). Reserved for future options.
Definition navmap_io.hpp:62