31 case RouteState::LOADING:
32 if(event == RouteEvent::ROUTE_LOADED)
34 state_ = RouteState::SELECTION;
37 case RouteState::SELECTION:
38 if(event == RouteEvent::ROUTE_SELECTED)
40 state_ = RouteState::ROUTING;
43 case RouteState::ROUTING:
44 if(event == RouteEvent::ROUTE_STARTED)
46 state_ = RouteState::FOLLOWING;
47 }
else if(event == RouteEvent::ROUTE_GEN_FAILED)
49 state_ = RouteState::SELECTION;
52 case RouteState::FOLLOWING:
53 if(event == RouteEvent::ROUTE_COMPLETED || event == RouteEvent::ROUTE_DEPARTED || event == RouteEvent::ROUTE_ABORTED)
55 state_ = RouteState::LOADING;
57 else if(event == RouteEvent::ROUTE_INVALIDATION)
59 state_ = RouteState::ROUTING;
67 RCLCPP_INFO_STREAM(
logger_->get_logger(),
"Received Route Event: " << event <<
" transitioning from: " << old_state <<
" to: " <<
state_);
RouteState getRouteState() const
Get current route state machine state.
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_
void setLoggerInterface(rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger)
void onRouteEvent(RouteEvent event)
Process route event based on designed state machine diagram.
auto to_string(const UtmZone &zone) -> std::string