5.5.3 Navigation (Optional)
The navigation module provides path planning and autonomous navigation interfaces, supporting robots to perform point-to-point navigation tasks within known maps, and also supports task control operations such as pause, resume, and stop.
Important
This is an optional component. To use the interfaces described on this page, please contact after-sales technical support.
Navigation Task Topic
Topic Name |
Data Type |
Description |
QoS |
Frequency |
|---|---|---|---|---|
|
|
Publish a navigation task request (start/pause/resume/stop) |
|
User (on-demand) |
|
|
Navigation Task Execution Result Feedback |
|
Event-driven (on task state change) |
|
|
Task engine status (main state, sub state, SLAM state, tour/pilot task state) |
|
1Hz |
Prerequisites
Before using navigation, ensure the following conditions are met:
Relocalization completed: The robot has been localized in the map (triggered via the
start_relocalization:<map_id>command, see SLAM)Working map set: The
map_idin the navigation request must match the map ID used for relocalization (the relocalization process automatically loads the target map and establishes localization; if a differentmap_idis specified during navigation, PNC will load that map’s data but the localization frame remains on the relocalization map, causing navigation errors).map_idmust be a valid, already-built map ID.Motion control mode is stable stand (
STAND_DEFAULT) or locomotion (LOCOMOTION_DEFAULT): The robot must be in a mode that can accept locomotion velocity commands, otherwise navigation tasks will be blocked. Stable stand and locomotion mode are unified; the velocity commands sent by navigation drive automatic internal switching between the two (see Motion Mode Switching).
PncTaskRequestros2-msg @ task_engine/msg/PncTaskRequest.msg# Navigation task request # Topic name: /aima/te/pnc_task_request MessageHeader header uint8 task_type # Task type, see enum definition TASK_TYPE uint8 task_request # Task request, see enum definition TASK_REQUEST uint8 pnc_mode # PNC mode (0: Enable obstacle avoidance, 1: Disable obstacle avoidance) uint64 task_id # Task ID; must match the one used when starting the task when pausing/resuming/stopping uint64 map_id # Map ID geometry_msgs/PoseStamped target_pose # Target pose geometry_msgs/Pose2D[] reference_line # Reference line (only considers x, y); target_pose holds the target orientation (yaw) float64 target_pose_radius # Target range radius (unit: m); minimum effective value is 0.25 float32 max_forward_speed # Maximum forward speed (unit: m/s, default 0.8) geometry_msgs/Pose2D[] trajectory_pos # (reserved) group-control parameter geometry_msgs/Twist[] trajectory_vel # (reserved) group-control parameter uint64 play_timestamp # (reserved) group-control parameter uint64 time_duration # (reserved) group-control parameter # 64-byte reserved field char[64] reserve_info
Available values for
task_type(defined by theTASK_TYPEenumeration):Enumeration Name
Value
Description
TASK_TYPE_PLANNING_NAVI_TO_POSE_2D2
Plan and navigate to a 2D pose
Other enum values are for internal use only.
Available values for
task_request(defined by theTASK_REQUESTenumeration):Enumeration Name
Value
Description
TASK_REQUEST_NONE0
No request
TASK_REQUEST_START1
Start navigation task
TASK_REQUEST_STOP2
Stop navigation, clear task status
TASK_REQUEST_PAUSE3
Pause navigation, robot stops in place, status retained
TASK_REQUEST_RESUME4
Resume the paused navigation task
TASK_REQUEST_STATUS_INQUIRY5
Query current task status
Interface Specification
Start Navigation
Set the target pose, map ID, obstacle-avoidance mode, and speed to initiate a navigation task.
PncTaskRequest.task_type = TASK_TYPE_PLANNING_NAVI_TO_POSE_2D
PncTaskRequest.task_request = TASK_REQUEST_START
PncTaskRequest.task_id = xxx // Task ID (millisecond timestamp)
PncTaskRequest.map_id = xxxx // Actual map ID in use
PncTaskRequest.pnc_mode = 0 // 0: Enable obstacle avoidance, 1: Disable
PncTaskRequest.max_forward_speed = 0.5 // Maximum forward speed (m/s)
PncTaskRequest.target_pose = ... // Target pose
PncTaskRequest.target_pose_radius = 0.5 // Reach accuracy (m)
Pause Navigation
Pause the current navigation task. The robot stops in place and the task state is preserved.
PncTaskRequest.task_type = TASK_TYPE_PLANNING_NAVI_TO_POSE_2D
PncTaskRequest.task_request = TASK_REQUEST_PAUSE
PncTaskRequest.task_id = xxx // Same task ID used when starting navigation
Resume Navigation
Resume the paused navigation task; the robot continues toward the previous navigation goal.
PncTaskRequest.task_type = TASK_TYPE_PLANNING_NAVI_TO_POSE_2D
PncTaskRequest.task_request = TASK_REQUEST_RESUME
PncTaskRequest.task_id = xxx // Same task ID used when starting navigation
Stop Navigation
Stop the current navigation task and clear the task state.
PncTaskRequest.task_type = TASK_TYPE_PLANNING_NAVI_TO_POSE_2D
PncTaskRequest.task_request = TASK_REQUEST_STOP
PncTaskRequest.task_id = xxx // Same task ID used when starting navigation
Reminder:
map_idis a required field (see Obtaining Map Identifiers and Coordinates for how to obtain it);task_idmust match the one used at the start when pausing/resuming/stopping.
Get Navigation Task Execution Result
Subscribe to the /aima/pnc/pnc_task_response topic to get the navigation
task execution result. This topic is published only once when the task
state changes (e.g. RUNNING/FAILED/FINISHED/PAUSED).
PncTaskResponseros2-msg @ task_engine/msg/PncTaskResponse.msg# Navigation task execution result # Topic: /aima/pnc/pnc_task_response MessageHeader header uint8 task_type # Task type, see TASK_TYPE enum uint64 task_id # Task ID (same as in request) uint64 map_id # Map ID uint8 task_status # Task status, see TASK_STATUS enum # 64 byte reserved char[64] reserve_info
Available values for
task_status(defined by theTASK_STATUSenumeration):Enumeration Name
Value
Description
TASK_STATUS_UNKONW0
Unknown status
TASK_STATUS_RUNNING1
Task running
TASK_STATUS_FAILED2
Task failed
TASK_STATUS_PAUSED3
Task paused
TASK_STATUS_FINISHED4
Task completed
TASK_STATUS_RECOVERY_TIMEOUT22
Recovery timeout
Other statuses
10-31
See
PncTaskResponse.msgdefinition
Warning
Navigation tasks may be automatically interrupted
When the robot detects a serious system fault (e.g. fall, system fault), the navigation task may be automatically interrupted. The robot plays a TTS prompt: “Sorry, a system fault has been detected and autonomous navigation tasks cannot be performed. Please check the fault cause in the client app.”
To programmatically detect whether a navigation task has been interrupted, use the following methods:
Subscribe to the
/aima/pnc/pnc_task_responsetopic and observe whethertask_statuschanges toFAILEDSubscribe to the
/task_master/statetopic and observe whethermain_statechanges fromPILOTtoIDLE
Get Task Engine Status
Subscribe to the /task_master/state topic to get the overall task engine
status. This topic is periodically published and continuously updates
the task engine state machine.
TaskMasterStateros2-msg @ task_engine/msg/TaskMasterState.msg# Task engine status # Topic: /task_master/state uint8 main_state # Main state, see TM_MAIN_STATE enum uint8 sub_state # Sub state, see TM_SUB_STATE enum uint8 slam_state # SLAM state, see SLAM_STATE enum uint64 loc_map_id # Current localization map ID (valid only when slam_state=LOCALIZATION) string loc_map_name # Current localization map name (valid only when slam_state=LOCALIZATION) FixLineIntroState fix_line_intro_state # Tour task status (valid only when main_state=FIX_LINE_INTRO) PilotState pilot_state # Pilot task status (valid only when main_state=PILOT) # Reserved information string reserve_info
Available values for
main_state(defined by theTM_MAIN_STATEenumeration):Enumeration Name
Value
Description
TM_MAIN_STATE_IDLE0
Idle
TM_MAIN_STATE_RELOCALIZATION1
Relocalizing
TM_MAIN_STATE_MAPPING2
Mapping
TM_MAIN_STATE_FIX_LINE_INTRO3
Tour task running
TM_MAIN_STATE_RECORDING_PATH4
Recording path
TM_MAIN_STATE_PILOT5
Pilot task running
Available values for
sub_state(defined by theTM_SUB_STATEenumeration):Enumeration Name
Value
Description
TM_SUB_STATE_NONE0
No sub state
TM_SUB_STATE_RESUME1
Long-running task active
TM_SUB_STATE_PAUSE2
Long-running task paused
Available values for
slam_state(defined by theSLAM_STATEenumeration):Enumeration Name
Value
Description
SLAM_STATE_IDLE0
SLAM idle
SLAM_STATE_RELOCALIZATION1
SLAM relocalizing
SLAM_STATE_MAPPING2
SLAM mapping
SLAM_STATE_LOCALIZATION3
SLAM localizing
FixLineIntroStateros2-msg @ task_engine/msg/FixLineIntroState.msg# Tour task status uint8 fix_line_intro_state # Tour task status, see TM_FIX_LINE_INTRO_STATE enum uint64 set_task_id # User-preset task ID (0 if not set) string set_task_name # User-preset task alias (empty if not set) string task_name # Task alias uint64 task_id # Task ID (generated on task creation) string map_name # Map alias (valid only when task depends on map) uint64 map_id # Map ID (generated on map creation) uint32 rest_site_number # Remaining tour sites (excluding current) uint64 cur_target_id # Current target point ID
Available values for
fix_line_intro_state(defined by theTM_FIX_LINE_INTRO_STATEenumeration):Enumeration Name
Value
Description
TM_FIX_LINE_INTRO_STATE_NAVI_TO_NEXT_SITE0
Navigate to next tour site
TM_FIX_LINE_INTRO_STATE_SITE_ACTIONS1
Execute current tour site action
TM_FIX_LINE_INTRO_STATE_NAVI_RETURN2
Navigate back to standby point
TM_FIX_LINE_INTRO_STATE_NAVI_TO_TARGET_POI3
Navigate to target POI
TM_FIX_LINE_INTRO_STATE_POI_ACTIONS4
Execute POI action
TM_FIX_LINE_INTRO_STATE_STANDBY_ACTIONS5
Standby action
PilotStateros2-msg @ task_engine/msg/PilotState.msg# Pilot task status uint8 pilot_state # Pilot task status, see TM_PILOT_STATE enum string target_name # Target point alias (POI alias when navigating to POI, tour site alias when navigating to tour site) uint64 target_id # Target point ID string intro_task_name # Tour task alias (valid only when navigating to a tour site created by a tour task) uint64 intro_task_id # Tour task ID string map_name # Map alias (valid only when task depends on map) uint64 map_id # Map ID (generated on map creation)
Available values for
pilot_state(defined by theTM_PILOT_STATEenumeration):Enumeration Name
Value
Description
TM_PILOT_STATE_NAVI_TO_TARGET0
Navigate to target point
TM_PILOT_STATE_TARGET_ACTIONS1
Execute target point action
TM_PILOT_STATE_NAVI_RETURN2
Navigate back
TM_PILOT_STATE_STANDBY_ACTIONS3
Standby action
Programming Examples
Refer to the following detailed programming examples and code explanations:
Python example (navigation): Navigation
C++ example (navigation): Navigation
Caution
As standard ROS DO NOT handle cross-host service (request-response) well, please refer to SDK examples to use open interfaces in a robust way (with protection mechanisms e.g. exception safety and retransmission)
While the robot is in Stable Standing Mode or Locomotion Mode, DO NOT launch ROS nodes in rapid bulk (no more than 2 nodes per second is recommended), as a large number of nodes joining DDS discovery within a short period causes communication congestion and degrades motion control real-time performance, which may cause the robot to lose balance and fall