Roban2 Docs
6历史文档5功能案例

SLAM System API Documentation

Overview

This document describes all API interfaces of the SLAM system, including services, topics, and actions. The system is built on ROS1 and integrates SLAM, navigation, map management, and other functions.

Table of Contents


1. Start Navigation

/move_base/goal

Interface Type: move_base_msgs/MoveBaseActionGoal

Description: Send a navigation goal to start a navigation task

Field Description:

Field NameData TypeMeaning
goal.target_pose.header.frame_idstringTarget coordinate frame (usually "map")
goal.target_pose.pose.position.xfloat64Target position X coordinate (meters)
goal.target_pose.pose.position.yfloat64Target position Y coordinate (meters)
goal.target_pose.pose.position.zfloat64Target position Z coordinate (meters)
goal.target_pose.pose.orientation.xfloat64Target orientation X component
goal.target_pose.pose.orientation.yfloat64Target orientation Y component
goal.target_pose.pose.orientation.zfloat64Target orientation Z component
goal.target_pose.pose.orientation.wfloat64Target orientation W component

Example Usage:

rostopic pub /move_base/goal move_base_msgs/MoveBaseActionGoal "header:
  seq: 0
  stamp: {secs: 0, nsecs: 0}
  frame_id: ''
goal_id:
  stamp: {secs: 0, nsecs: 0}
  id: ''
goal:
  target_pose:
    header:
      seq: 0
      stamp: {secs: 0, nsecs: 0}
      frame_id: 'map'
    pose:
      position: {x: 1.0, y: 2.0, z: 0.0}
      orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}"

2. Navigation Status Monitoring

/move_base/status

Interface Type: actionlib_msgs/GoalStatusArray

Description: View the execution status of the current navigation goal

Field Description:

Field NameData TypeMeaning
status_list[].goal_id.idstringGoal ID
status_list[].statusuint8Status code
status_list[].textstringStatus description text

Status Code Description:

Status CodeStatus NameMeaning
0PENDINGWaiting
1ACTIVEExecuting
2PREEMPTEDCanceled (successfully canceled)
3SUCCEEDEDNavigation completed successfully
4ABORTEDNavigation failed
5REJECTEDExecution rejected

Example Usage:

rostopic echo /move_base/status

Example Output:

status_list:
- goal_id:
    id: "goal_2025-06-26-13-45-00"
  status: 2
  text: "Goal canceled."

⚠️ Important Note: Although status_list is an array, in practice you usually only need to retrieve the first element (status_list[0]), because the system typically handles only one navigation goal.

3. Cancel Navigation

/move_base/cancel

Interface Type: actionlib_msgs/GoalID

Description: Cancel the currently executing navigation task or all pending goals

Field Description:

Field NameData TypeMeaning
idstringGoal ID (an empty string means cancel all goals)

Usage:

Cancel All Navigation Goals
rostopic pub /move_base/cancel actionlib_msgs/GoalID '{}'

Map Management Services

/load_map

Service Type: kuavo_mapping/LoadMap

Description: Load the specified map file

Request Parameters:

Field NameData TypeMeaning
map_namestringMap name

Response Parameters:

Field NameData TypeMeaning
successboolLoad success status
messagestringStatus message

Example Usage:

rosservice call /load_map "map_name: 'map_2025-01-15_10-30-00'"

/get_current_map

Service Type: kuavo_mapping/GetCurrentMap

Description: Get the name of the currently loaded map

Request Parameters: None

Response Parameters:

Field NameData TypeMeaning
current_mapstringName of the currently loaded map

Example Usage:

rosservice call /get_current_map

/get_all_maps

Service Type: kuavo_mapping/GetAllMaps

Description: Get the list of all available maps

Request Parameters: None

Response Parameters:

Field NameData TypeMeaning
mapsstring[]List of all available map names

Example Usage:

rosservice call /get_all_maps

Task Point Management Services

/task_point

Service Type: kuavo_mapping/TaskPointOperation

Description: Create, read, update, and delete task points

Operation Type Constants:

Constant ValueOperation NameMeaning
0ADDAdd a task point
1UPDATEUpdate a task point
2DELETEDelete a task point
3GETGet all task points

Request Parameters:

Field NameData TypeRequiredMeaning
operationint8✅Operation type (0-3)
task_point.pose.position.xfloat64⚠️Task point X coordinate (meters); required for ADD/UPDATE unless use_robot_current_pose=true
task_point.pose.position.yfloat64⚠️Task point Y coordinate (meters); required for ADD/UPDATE unless use_robot_current_pose=true
task_point.pose.position.zfloat64⚠️Task point Z coordinate (meters); required for ADD/UPDATE unless use_robot_current_pose=true
task_point.pose.orientation.xfloat64⚠️Task point orientation X component; required for ADD/UPDATE unless use_robot_current_pose=true
task_point.pose.orientation.yfloat64⚠️Task point orientation Y component; required for ADD/UPDATE unless use_robot_current_pose=true
task_point.pose.orientation.zfloat64⚠️Task point orientation Z component; required for ADD/UPDATE unless use_robot_current_pose=true
task_point.pose.orientation.wfloat64⚠️Task point orientation W component; required for ADD/UPDATE unless use_robot_current_pose=true
task_point.namestring⚠️Task point name; optional for ADD, required for UPDATE/DELETE
namestring⚠️Task point name (used for the operation); optional for ADD, required for UPDATE/DELETE
use_robot_current_posebool❌Whether to use the robot's current pose (for ADD/UPDATE operations); defaults to false

Response Parameters:

Field NameData TypeMeaning
successboolOperation success status
messagestringStatus message
task_points[].pose.position.xfloat64Task point X coordinate (returned by GET)
task_points[].pose.position.yfloat64Task point Y coordinate (returned by GET)
task_points[].pose.position.zfloat64Task point Z coordinate (returned by GET)
task_points[].pose.orientation.xfloat64Task point orientation X component (returned by GET)
task_points[].pose.orientation.yfloat64Task point orientation Y component (returned by GET)
task_points[].pose.orientation.zfloat64Task point orientation Z component (returned by GET)
task_points[].pose.orientation.wfloat64Task point orientation W component (returned by GET)
task_points[].namestringTask point name (returned by GET)

Operation Details:

ADD Operation (operation=0)

  • name: Optional. If not provided, a default name is used.
  • use_robot_current_pose: If true, the task_point.pose field is ignored and the robot's current pose is used.
  • task_point.pose: Required when use_robot_current_pose=false.

UPDATE Operation (operation=1)

  • name: Required. Specifies the name of the task point to update.
  • use_robot_current_pose: If true, the task_point.pose field is ignored and the robot's current pose is used.
  • task_point.pose: Required when use_robot_current_pose=false.

DELETE Operation (operation=2)

  • name: Required. Specifies the name of the task point to delete.
  • All other fields are ignored.

GET Operation (operation=3)

  • All fields are ignored, and the list of all task points is returned.

Example Usage:

Add a Task Point (Using a Specified Pose)

rosservice call /task_point "operation: 0
task_point:
  pose:
    position: {x: 1.0, y: 2.0, z: 0.0}
    orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
  name: 'home_position'
name: 'home_position'
use_robot_current_pose: false"

Add a Task Point (Using the Robot's Current Pose)

rosservice call /task_point "operation: 0
task_point:
  pose:
    position: {x: 0.0, y: 0.0, z: 0.0}
    orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
  name: 'current_position'
name: 'current_position'
use_robot_current_pose: true"

Update a Task Point

rosservice call /task_point "operation: 1
task_point:
  pose:
    position: {x: 2.0, y: 3.0, z: 0.0}
    orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
  name: 'home_position'
name: 'home_position'
use_robot_current_pose: false"

Delete a Task Point

rosservice call /task_point "operation: 2
task_point:
  pose:
    position: {x: 0.0, y: 0.0, z: 0.0}
    orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
  name: 'home_position'
name: 'home_position'
use_robot_current_pose: false"

Get All Task Points

rosservice call /task_point "operation: 3
task_point:
  pose:
    position: {x: 0.0, y: 0.0, z: 0.0}
    orientation: {x: 0.0, y: 0.0, z: 0.0, w: 1.0}
  name: ''
name: ''
use_robot_current_pose: false"

Service Type: kuavo_mapping/NavigateToTaskPoint

Description: Navigate to the specified task point

Request Parameters:

Field NameData TypeMeaning
task_namestringTask point name

Response Parameters:

Field NameData TypeMeaning
successboolNavigation start status
messagestringStatus message

Example Usage:

rosservice call /navigate_to_task_point "task_name: 'home_position'"

Global Localization Service

/initialpose_with_taskpoint

Service Type: kuavo_mapping/InitialPoseWithTaskPoint

Description: Global localization based on a task point

Request Parameters:

Field NameData TypeMeaning
task_point_namestringTask point name

Response Parameters:

Field NameData TypeMeaning
successboolOperation success status
messagestringStatus message

Usage: Receives a task point name, looks up the corresponding task point pose by name, and automatically calls the set_initialpose service to perform global localization

Example Usage:

# 通过任务点名称进行定位
rosservice call /initialpose_with_taskpoint "task_point_name: 'task1'"

Notes

⚠️ Important Notes:

  • When mapping, the robot's lidar must be level with the ground; any tilt will cause mapping to fail
  • It is recommended to position the robot's head motors first, put the robot program into cali_arm mode, and enable the head motors before mapping
  • During mapping, the user should stand behind the robot to avoid blocking the lidar's field of view
  • Ensure there are no dynamic objects in the environment; the environment should remain relatively static during mapping
  • Back up the original file before editing the map, and take care to maintain data consistency while editing

Localization and Map Switching

  • ⚠️ Important Limitation: If you switch maps (load_map) after an initial pose has been provided, you can no longer perform global localization
  • It is recommended to provide the initial pose only after you have determined which map to use

Task Point Management

  • Task point names must be unique within the same map
  • When using use_robot_current_pose=true, make sure the robot's pose is accurate
  • Deleting a task point cannot be undone, so proceed with caution

Global Localization Service

  • The initialpose_with_taskpoint service is provided by the map_manager node and is used to set the initial pose by task point name
  • The set_initialpose service is provided by the global_localization node and is used to set the initial pose directly
  • Service call flow: initialpose_with_taskpoint → map_manager looks up the task point → calls set_initialpose → global_localization handles localization
  • Service calls are synchronous and wait for the operation to complete before returning a result

Troubleshooting

Common Issues

  1. PCD file does not exist: Check whether map construction is complete, and wait long enough for FAST-LIO to generate point cloud data.
  2. Navigation failure: Check whether the map file path is correct, and make sure the coordinate frame configuration is correct.
  3. Abnormal sensor data: Check the LiDAR connection and driver configuration.
  4. Localization failure: Make sure global localization has completed, and check whether the TF transforms are correct.
  5. Task point operation failure: Check whether Map Manager is running properly and whether the database permissions are correct.
  6. Unable to localize after switching maps: After switching maps, global localization must be performed again. If an initial pose has already been set previously, you may need to restart the navigation node.
  7. initialpose_with_taskpoint service call failure:
    • Check whether the task point name exists
    • Make sure the map_manager node is running properly
    • Check whether the global_localization node is started and provides the set_initialpose service
  8. set_initialpose service call failure:
    • Make sure the global_localization node is running properly
    • Check whether the pose data format is correct
    • Make sure the coordinate frame is set correctly (usually "map")