SetMode
Service type: fourier_msgs/srv/SetMode
Service name: /slam/set_mode
Description
Switch between mapping and localization modes.
Request
| Field | Type | Description |
|---|---|---|
mode | string | Requested operating mode. Mapping accepts mapping, slam, or 0; localization accepts localization, loc, or 1. Values are case-insensitive. |
Response
| Field | Type | Description |
|---|---|---|
success | bool | Whether the operation succeeded. |
result | uint32 | Result code; see the table below. |
message | string | Result details or an error message. |
Result Codes
| Code | Description |
|---|---|
0 | Switched to the requested mode successfully. |
1 | The system is already in the requested mode. |
2 | The mode name is invalid. |
3 | Mode switching failed. |
Switching Behavior
Mapping to localization:
- Save the current map.
- Load it for localization.
- Set the initial robot pose.
Localization to mapping:
- Clear cached map data.
- Restart the mapping module.
- Resume publication of the live 2D occupancy grid.