Skip to main content

delete_map_archive

Service type: map_manager/srv/SaveCompositeMap

Service name: /delete_map_archive

Description​

Deletes the saved map archive at map_path. The service reuses the request and response types of SaveCompositeMap; it deletes only the archive directory and does not clear the current runtime map.

map_path must be a direct child of the configured archive root. It cannot be an arbitrary filesystem path, the archive root itself, or a deeper directory. The default root is /opt/fftai/nav/nav-map, so the default path form is /opt/fftai/nav/nav-map/<map-id>. After validating the path, the service deletes only that archive directory and its contents; the runtime map is left untouched.

Request (Request)​

FieldTypeDescription
map_pathstringArchive directory to delete; a direct child of the archive root.
compressboolReused compatibility field; ignored by deletion.

Response (Response)​

FieldTypeDescription
successboolWhether deletion succeeded.
messagestringResult or error message.
saved_pathstringRequested map_path.

Example​

The examples below use the default archive root /opt/fftai/nav/nav-map. If a deployment changes the archive root, replace the root directory in the examples with the configured value; map_path must still be a direct child of that root.

CLI call​

Bash
ros2 service call /delete_map_archive map_manager/srv/SaveCompositeMap \
"{map_path: '/opt/fftai/nav/nav-map/office', compress: false}"

Python example​

Python
import rclpy
from rclpy.node import Node
from map_manager.srv import SaveCompositeMap


rclpy.init()
node = Node('map_archive_deleter')
client = node.create_client(SaveCompositeMap, '/delete_map_archive')
client.wait_for_service()
request = SaveCompositeMap.Request()
request.map_path = '/opt/fftai/nav/nav-map/office'
request.compress = False
future = client.call_async(request)
rclpy.spin_until_future_complete(node, future)
print(future.result().message)
node.destroy_node()
rclpy.shutdown()

C++ example​

C++
#include <memory>
#include <rclcpp/rclcpp.hpp>
#include <map_manager/srv/save_composite_map.hpp>

auto node = std::make_shared<rclcpp::Node>("map_archive_deleter");
auto client = node->create_client<map_manager::srv::SaveCompositeMap>(
"/delete_map_archive");
client->wait_for_service();

auto request = std::make_shared<map_manager::srv::SaveCompositeMap::Request>();
request->map_path = "/opt/fftai/nav/nav-map/office";
request->compress = false;
auto future = client->async_send_request(request);
if (rclcpp::spin_until_future_complete(node, future) ==
rclcpp::FutureReturnCode::SUCCESS) {
RCLCPP_INFO(node->get_logger(), "%s", future.get()->message.c_str());
}