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
45
46#include "navmap_ros_interfaces/msg/nav_map.hpp"
47
52namespace navmap_ros::io
53{
54
61{
63 bool binary{true};
64};
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.
Main container for navigable surfaces, geometry, and layers.
Definition NavMap.hpp:434
Conversions between the core NavMap representation and ROS messages.
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:61
bool binary
If true, save in binary (CDR). Reserved for future options.
Definition navmap_io.hpp:63