Skip to content

Mapping Service Interfaces

Introduction

Mapping Service Interfaces:

Provides SLAM map creation, loading, and management functionality. A map must be loaded and localization completed before using navigation interfaces.

PurposePython
Start Mapping
Stop Mapping and Save
Load Map
Get Available Maps

Mapping Mode

Python Interface

start_mapping(timeout=120)

Function Description
Start SLAM mapping mode. The robot begins scanning and building a point cloud map of the surrounding environment. After starting, manually drive the robot through the target area to achieve full coverage.

Parameter Description

Parameter NameTypeRequired/DefaultDescription
timeoutint120Timeout in seconds for mapping mode to start.

Return Value

TypeDescription
StartMappingResponsestate.code == 0 and success is True indicates mapping mode has started.

Example

python
from daystar_api.lowlevel_skills import start_mapping, stop_mapping
import time

# Start mapping
result = start_mapping()
if result.success:
    print("Mapping started, drive the robot to scan the area...")
    time.sleep(300)  # Drive robot for 5 minutes to scan
    stop_mapping("office_map")

stop_mapping(map_name, auto_reload=False, need_2d_map=True, block=True, timeout=30)

Function Description
Stop SLAM mapping, save the map file, and switch back to map localization mode.

Parameter Description

Parameter NameTypeRequired/DefaultDescription
map_namestrRequiredName to save the map as.
auto_reloadboolFalseIf True, automatically load this map after saving for immediate use.
need_2d_mapboolTrueWhether to also generate a 2D grid map.
blockboolTrueIf True, block until map saving completes.
timeoutint30Timeout in seconds for the map saving operation.

Return Value

TypeDescription
StopMappingResponsestate.code == 0 and success is True indicates map was saved successfully.

Example

python
from daystar_api.lowlevel_skills import stop_mapping

# Stop mapping and save, then auto-load
result = stop_mapping("office_floor1", auto_reload=True)
if result.success:
    print("Map saved and loaded")

Map Operations

Python Interface

load_map(map_name, auto_reload=True, timeout=30)

Function Description
Load an existing map from the map resource directory (/root/data/daystar_api/maps). After loading, automatically switches to localization mode.

Parameter Description

Parameter NameTypeRequired/DefaultDescription
map_namestrRequiredMap name (must exist in the resource directory).
auto_reloadboolTrueIf True, load permanently (also used on next startup); if False, only for current session.
timeoutint30Timeout in seconds for loading to complete.

Return Value

TypeDescription
LoadMapResponsestate.code == 0 and success is True indicates map loaded successfully.

Example

python
from daystar_api.lowlevel_skills import load_map

# Load map permanently
result = load_map("office_floor1")
if result.success:
    print("Map loaded successfully")

# Temporary load (current session only)
result = load_map("warehouse_map", auto_reload=False)

# Large map needs longer timeout
result = load_map("large_outdoor_map", timeout=60)

get_available_maps(timeout=5)

Function Description
Get a list of all available map names in the map resource directory.

Parameter Description

Parameter NameTypeRequired/DefaultDescription
timeoutint5Query timeout in seconds.

Return Value

TypeDescription
GetAvailableMapsResponsestate.code == 0 indicates query succeeded; response.map_names is the list of map names; response.success is a boolean.

Example

python
from daystar_api.lowlevel_skills import get_available_maps, load_map

result = get_available_maps()
if result.response.success:
    print("Available maps:")
    for name in result.response.map_names:
        print(f"  - {name}")

# Check if target map exists
if "office_map" in result.response.map_names:
    load_map("office_map")