This document provides detailed instructions on how to communicate with the UNav server. The server offers various endpoints to manage settings, start/terminate the server, localize images, get floorplans, select destinations, and navigate paths.
The base URL for all API requests is:
Endpoint: /settings
Method: POST
Description: Setup desired navigation scene.
Request Format:
{
"place": "New_York_City",
"building": "LightHouse",
"floor": "6th_floor",
"scale": 0.01098358101
}
Endpoint: /start
Method: POST
Description: Start the server and initialize required components.
Request Format: None
Response Format:
{
"status": "server started"
}
Endpoint: /terminate
Method: POST
Description: Terminate the server and clean up resources.
Request Format: None
Response Format:
{
"status": "server terminated"
}
Endpoint: /localize
Method: POST
Description: Localize the user’s position based on a query image.
Request Format:
{
"query_image": "data:image/png;base64,<base64_encoded_image>"
}
Response Format:
-
Success:
{ "pose": [x, y, angle] }
-
Failure:
{ "pose": null }
Endpoint: /get_floorplan_and_destinations
Method: GET
Description: Retrieve the floorplan image and destination points.
Response Format:
{
"floorplan": "<base64_encoded_image>",
"destinations": [
{
"name": "ADA Restroom",
"id": "07993",
"location": [x, y]
},
...
],
"anchors": [
[x, y],
...
]
}
Endpoint: /select_destination
Method: POST
Description: Select a destination for navigation.
Request Format:
{
"destination_id": "07993"
}
Response Format:
{
"status": "success"
}
Endpoint: /planner
Method: GET
Description: Get the navigation path from the current position to the selected destination.
Response Format:
-
Success:
{ "paths": [ [x, y], [x, y, "floor_name"], ... ], "floorplan": "<base64_encoded_image>", "actions": [rotation, distance, rotation, distance, ...] }
-
Failure:
{ "error": "Pose or selected destination ID is not set" }
Endpoint: /list_images
Method: GET
Description: List available images for localization.
Response Format:
{
"id1": ["image1.png", "image2.png"],
"id2": ["image1.png", "image2.png"],
...
}
Endpoint: /get_image/<id>/<image_name>
Method: GET
Description: Retrieve a specific image by ID and image name.
Response Format:
{
"image": "<base64_encoded_image>"
}
Send a 'POST' request to /settings
with the required settings.
Send a 'POST' request to /start
to initialize the server.
Send a 'GET' request to /list_images
to get available images and then a 'GET' request to /get_image/{id}/{image_name}
to retrieve the selected image.
Note: This step is optional, just for testing your system in case you don't have a query image. You can use the image you captured.
Send a 'POST' request to /localize
with the selected query image in base64 format.
Send a 'GET' request to /get_floorplan_and_destinations
to get the floorplan and destinations. Then send a 'POST' request to /select_destination
with the selected destination ID.
Send a 'GET' request to /planner
to get the navigation path.
Send a 'POST' request to /terminate
to shut down the server.