Navigate the robot to predefined goal locations.(将机器人导航至预定义目标位置。)
Navigate the robot to predefined goal locations, and record new goals.
This skill covers the full robot navigation lifecycle, comprising four sub-functions with the following execution order:
Mapping → Pose Initialization → Mark Waypoints (repeatable) → Navigate
Get SLAM State can be called at any time to query the current system state.
All underlying scripts live in {baseDir}/scripts/.
BEFORE executing any motion-related command:
1. Run: curl -s http://localhost:18790/api/home/status | jq '.data.available | any(. == "运动")'
2. If the output is false: STOP and tell the user "Motion mode is not enabled"
4. If found: Proceed with the motion command
DO NOT skip this check. DO NOT execute motion commands without verification.
Trigger: The user asks the robot to map a new environment, or the existing map needs to be rebuilt.
Workflow:
Capture the current camera frame.
Inform the user: "Mapping is about to begin. Are you ready?"
Wait for the user to confirm they are ready.
Start mapping:
uv run {baseDir}/scripts/build_map.py start
Inform the user: "Mapping has started. Please use the remote control to drive the robot in a complete loop around the area to be mapped. Let me know when you are done."
Wait for the user to confirm the robot has completed the loop.
End mapping:
uv run {baseDir}/scripts/build_map.py end
---
## Sub-function 2: Pose Initialization (Relocation)
**Trigger:** After mapping is complete and before first use of navigation, or when the robot has lost its position and needs to relocalize.
**Workflow:**
1. Capture the current camera frame。
2. Start relocation:
```bash
uv run {baseDir}/scripts/init_pose.py eth0
statusCode == 0 → initialized is saved as true in slam_state.json. Inform the user that initialization succeeded.statusCode != 0 → Inform the user: "The robot is not within the mapped area. Please move the robot back into the mapped area and try again." Do not proceed with any navigation operations.Trigger: The user says "I want to add a new navigation waypoint" or similar.
Prerequisite: Pose initialization (sub-function 2) must have been completed. If not, prompt the user to run initialization first.
This sub-function involves a multi-turn dialogue, as follows:
1. Capture the current camera frame。
2. Robot replies:
"Please make sure you are within the mapped area, then use the remote
control to drive the robot to the position you want to mark. Let me
know when you are done."
3. Wait for the user to confirm (e.g. "Done", "I've marked it", "OK", etc.).
4. Robot replies:
"Please give this waypoint a name."
5. Wait for the user to provide a name (e.g. "fridge").
6. Record the waypoint:
uv run {baseDir}/scripts/record_goal.py <goal_name>
7. Read the returned result:
- Outputs "已保存目标点: <name>" → Inform the user the waypoint was saved,
e.g. "The current position has been marked as 'fridge'."
- Outputs "获取当前位置失败" → Inform the user that marking failed.
Trigger: The user asks the robot to go to a previously marked waypoint.
Workflow:
cat {baseDir}/scripts/slam_state.json
Confirm has_map == true and initialized == true. If any condition is not met → Inform the user which prerequisite is missing.
uv run {baseDir}/scripts/nav_to_goal.py --list
Confirm the target waypoint is in the returned list. If not → Inform the user the waypoint does not exist.
Capture the current camera frame。
Start navigation:
uv run {baseDir}/scripts/nav_to_goal.py --target <goal_name>
Read the returned result:
is_arrived: true → Inform the user the robot has arrived at the target.Collision handling (built into nav_to_goal.py):
Trigger: Whenever the current navigation system state needs to be queried, or as a prerequisite check before executing navigation.
Workflow:
Capture the current camera frame。
Get SLAM state and goal list:
cat {baseDir}/scripts/slam_state.json
uv run {baseDir}/scripts/nav_to_goal.py --list
State fields in slam_state.json:
| Field | Description |
|---|---|
has_map | Whether a map has been built |
initialized | Whether pose initialization has been completed |
current_goal | The goal the robot is currently navigating to (if any) |
Trigger: The user asks to delete the current map, clear all navigation data, or start fresh.
Workflow:
Warn the user: "This will permanently delete the current map and all saved waypoints. Are you sure you want to continue?"
Wait for the user to confirm.
Delete the map state and waypoint files:
rm -f {baseDir}/scripts/slam_state.json
rm -f {baseDir}/scripts/poses.json
record_goal.py to save the robot's current position as a new named goal, with the goal stored in {baseDir}/scripts/poses.json.--list to dynamically view all available goals from poses.json.