Skip to main content

SetMode

Service type: fourier_msgs/srv/SetMode

Service name: /slam/set_mode

Description​

Switch between mapping and localization modes.

Request​

FieldTypeDescription
modestringRequested operating mode. Mapping accepts mapping, slam, or 0; localization accepts localization, loc, or 1. Values are case-insensitive.

Response​

FieldTypeDescription
successboolWhether the operation succeeded.
resultuint32Result code; see the table below.
messagestringResult details or an error message.

Result Codes​

CodeDescription
0Switched to the requested mode successfully.
1The system is already in the requested mode.
2The mode name is invalid.
3Mode switching failed.

Switching Behavior​

Mapping to localization:

  1. Save the current map.
  2. Load it for localization.
  3. Set the initial robot pose.

Localization to mapping:

  1. Clear cached map data.
  2. Restart the mapping module.
  3. Resume publication of the live 2D occupancy grid.