High-Level Skills Interfaces
Introduction
High-Level Skills Interfaces:
Encapsulates complex prerequisite state checks and low-level call sequences to provide ready-to-use high-level interfaces for common robot tasks. Callers do not need to manually handle localization state, posture switching, mode switching, and other complex workflows.
| Purpose | Python |
|---|---|
| Smart Navigation to Location (with pre-checks and graph planning) | ✔ |
Smart Navigation
Python Interface
go_to_location(location=None, pose=None, travel_params=None, timeout=600, complete_callback=None, failed_callback=None, progress_callback=None, graph_file=None, start_location=None)
Function Description
High-level skill for navigating to a specified location or pose. Automatically performs the following prerequisite checks and adjustments — callers do not need to handle these manually:
- Validate target location (location mode only): checks whether the target location is registered, supports fuzzy matching of spoken suffixes
- Check localization state: if localization is abnormal, automatically triggers relocalization (
set_localization(auto_relocation=True)) - Check robot posture: if not standing, automatically executes stand up (
stand_up()) - Check control mode: if not in navigation mode, automatically switches to
NAV_MODE
Road Network Planning (only effective in location mode): If a road network graph file exists in the config directory and the target location is in the network, automatically splits navigation into multiple segments; otherwise falls back to direct navigation.
Parameter Description
| Parameter Name | Type | Required/Default | Description |
|---|---|---|---|
location | str | One of location or pose | Target location name (must be registered in the system). Mutually exclusive with pose. |
pose | Pose | One of location or pose | Target pose object, suitable for "return to origin" scenarios. Typically used with get_current_pose(). Mutually exclusive with location. |
travel_params | MsgTravelParams | None | Navigation travel parameters; uses default parameters when None. |
timeout | int | 600 | Total navigation timeout in seconds. When road network planning is enabled, per-segment timeout is max(60, timeout // num_segments). |
complete_callback | callable | None | Callback when navigation successfully arrives; receives NavCompleteEvent. |
failed_callback | callable | None | Callback when navigation fails; receives NavFailedEvent. |
progress_callback | callable | None | Progress callback during navigation; receives NavProgressEvent. |
graph_file | str | None | Road network graph filename or path. When None, automatically discovers the default graph in the config directory (default.yaml or the first .yaml file). |
start_location | str | None | Starting road network node name. When None, automatically matches the nearest node based on current position. |
Return Value
| Type | Description |
|---|---|
IntelligentNavigationResponse | state.code == 0 indicates successfully reached the target. |
Exceptions
| Exception | Description |
|---|---|
GoToLocationError | Raised when a prerequisite check fails, with an English description (e.g., location not found, relocalization failed, stand up failed). |
Example
from daystar_api.highlevel_skills import go_to_location
# Navigate to a named location (auto pre-checks + auto road network planning)
result = go_to_location("break_room")
if result.state.code == 0:
print("Arrived at break room")
# Specify road network graph file
result = go_to_location("meeting_room", graph_file="office")
# Specify starting node (more accurate when current location is known)
result = go_to_location("meeting_room", start_location="lobby")
# Return to starting position (record position first, then return after task)
from daystar_api.lowlevel_skills import get_current_pose
pose_resp = get_current_pose()
origin_pose = pose_resp.response.location_pose
# ... perform other tasks ...
result = go_to_location(pose=origin_pose)
# With error handling
from daystar_api.highlevel_skills import GoToLocationError
try:
go_to_location("unregistered_location")
except GoToLocationError as e:
print(f"Navigation prerequisite check failed: {e}")