15 #ifndef CONCEALER__LEGACY_AUTOWARE_STATE_HPP_
16 #define CONCEALER__LEGACY_AUTOWARE_STATE_HPP_
18 #if __has_include(<autoware_system_msgs/msg/autoware_state.hpp>)
19 #include <autoware_system_msgs/msg/autoware_state.hpp>
22 #if __has_include(<autoware_adapi_v1_msgs/msg/localization_initialization_state.hpp>)
23 #include <autoware_adapi_v1_msgs/msg/localization_initialization_state.hpp>
26 #if __has_include(<autoware_adapi_v1_msgs/msg/operation_mode_state.hpp>)
27 #include <autoware_adapi_v1_msgs/msg/operation_mode_state.hpp>
30 #if __has_include(<autoware_adapi_v1_msgs/msg/route_state.hpp>)
31 #include <autoware_adapi_v1_msgs/msg/route_state.hpp>
53 #if __has_include(<autoware_system_msgs/msg/autoware_state.hpp>)
54 explicit LegacyAutowareState(
const autoware_system_msgs::msg::AutowareState & autoware_state)
56 switch (autoware_state.state) {
57 case autoware_system_msgs::msg::AutowareState::INITIALIZING:
59 case autoware_system_msgs::msg::AutowareState::WAITING_FOR_ROUTE:
61 case autoware_system_msgs::msg::AutowareState::PLANNING:
63 case autoware_system_msgs::msg::AutowareState::WAITING_FOR_ENGAGE:
65 case autoware_system_msgs::msg::AutowareState::DRIVING:
67 case autoware_system_msgs::msg::AutowareState::ARRIVED_GOAL:
69 case autoware_system_msgs::msg::AutowareState::FINALIZING:
77 #if __has_include(<autoware_adapi_v1_msgs/msg/localization_initialization_state.hpp>) and \
78 __has_include(<autoware_adapi_v1_msgs/msg/route_state.hpp>) and \
79 __has_include(<autoware_adapi_v1_msgs/msg/operation_mode_state.hpp>)
81 const autoware_adapi_v1_msgs::msg::LocalizationInitializationState & localization_state,
82 const autoware_adapi_v1_msgs::msg::RouteState & route_state,
83 const autoware_adapi_v1_msgs::msg::OperationModeState & operation_mode_state,
84 const rclcpp::Time & now)
92 localization_state.state ==
93 autoware_adapi_v1_msgs::msg::LocalizationInitializationState::UNKNOWN or
94 route_state.state == autoware_adapi_v1_msgs::msg::RouteState::UNKNOWN or
95 operation_mode_state.mode == autoware_adapi_v1_msgs::msg::OperationModeState::UNKNOWN) {
98 switch (localization_state.state) {
99 case autoware_adapi_v1_msgs::msg::LocalizationInitializationState::UNINITIALIZED:
100 case autoware_adapi_v1_msgs::msg::LocalizationInitializationState::INITIALIZING:
103 case autoware_adapi_v1_msgs::msg::LocalizationInitializationState::INITIALIZED:
104 switch (route_state.state) {
105 case autoware_adapi_v1_msgs::msg::RouteState::ARRIVED:
106 if (
const auto duration = now - rclcpp::Time(route_state.stamp);
107 duration.seconds() < 2.0) {
112 case autoware_adapi_v1_msgs::msg::RouteState::UNSET:
115 case autoware_adapi_v1_msgs::msg::RouteState::SET:
116 case autoware_adapi_v1_msgs::msg::RouteState::CHANGING:
117 switch (operation_mode_state.mode) {
118 case autoware_adapi_v1_msgs::msg::OperationModeState::AUTONOMOUS:
119 case autoware_adapi_v1_msgs::msg::OperationModeState::LOCAL:
120 case autoware_adapi_v1_msgs::msg::OperationModeState::REMOTE:
121 if (operation_mode_state.is_autoware_control_enabled) {
126 case autoware_adapi_v1_msgs::msg::OperationModeState::STOP:
147 constexpr
operator const char *()
const
151 return "INITIALIZING";
153 return "WAITING_FOR_ROUTE";
157 return "WAITING_FOR_ENGAGE";
161 return "ARRIVED_GOAL";
173 return os << static_cast<const char *>(state);
Definition: autoware_universe.hpp:40
std::string string
Definition: junit5.hpp:26
Definition: legacy_autoware_state.hpp:37
value_type value
Definition: legacy_autoware_state.hpp:49
constexpr LegacyAutowareState(value_type value)
Definition: legacy_autoware_state.hpp:51
friend auto operator<<(std::ostream &os, const LegacyAutowareState &state) -> std::ostream &
Definition: legacy_autoware_state.hpp:171
value_type
Definition: legacy_autoware_state.hpp:38
@ initializing
Definition: legacy_autoware_state.hpp:40
@ driving
Definition: legacy_autoware_state.hpp:44
@ planning
Definition: legacy_autoware_state.hpp:42
@ waiting_for_engage
Definition: legacy_autoware_state.hpp:43
@ waiting_for_route
Definition: legacy_autoware_state.hpp:41
@ finalizing
Definition: legacy_autoware_state.hpp:46
@ arrived_goal
Definition: legacy_autoware_state.hpp:45
@ undefined
Definition: legacy_autoware_state.hpp:39