# Drive to the designated position

The application sets a route to the goal and starts autonomous driving. Autoware drives to the goal and stops there.

## Related API

- [Operation mode](<../../features/operation_mode/index.md>)
- [Routing](<../../features/routing/index.md>)

## Sequence

Set a route, start autonomous driving, and clear the route at the goal.

1. **Set the route.** When the route state is `UNSET`, call [/api/routing/set\_route\_points](<../../list/api/routing/set_route_points/index.md>) with the goal pose and the waypoints, or [/api/routing/set\_route](<../../list/api/routing/set_route/index.md>) with lanelet segments. The route state changes to `SET`.
2. **Wait until the autonomous mode is available.** Autoware checks its components, for example the route, the localization, and the planning output. When all checks pass, `is_autonomous_mode_available` of [/api/operation\_mode/state](<../../list/api/operation_mode/state/index.md>) becomes `true`.
3. **Start.** Call [/api/operation\_mode/change\_to\_autonomous](<../../list/api/operation_mode/change_to_autonomous/index.md>). Autoware starts to drive along the route.
4. **Arrive.** At the goal, the route state changes to `ARRIVED`. In the default implementation, the routing node of AD API then changes the operation mode to stop.
5. **Clear the route.** Call [/api/routing/clear\_route](<../../list/api/routing/clear_route/index.md>). The route state changes to `UNSET`, and the application can set the next route.

To change the goal while the vehicle drives, use [/api/routing/change\_route\_points](<../../list/api/routing/change_route_points/index.md>) or [/api/routing/change\_route](<../../list/api/routing/change_route/index.md>). See [routing](<../../features/routing/index.md>) for the route states.
