template <typename Thunk = void (*)(), typename Interval = std::chrono::seconds> \
auto waitForAutowareStateToBe##
STATE( \
Thunk && thunk = [] {}, Interval interval = std::chrono::seconds(1)) \
{ \
for (thunk(); not static_cast<const Autoware &>(*this).isStopRequested() and \
not
static_cast<const Autoware &
>(*this).is##
STATE(); \
rclcpp::GenericRate<std::chrono::steady_clock>(interval).sleep()) { \
if ( \
have_never_been_engaged and \
start + initialize_duration <= std::chrono::steady_clock::now()) { \
const auto state = static_cast<const Autoware &>(*this).getAutowareStateName(); \
"Simulator waited for the Autoware state to transition to " #
STATE \
", but time is up. The current Autoware state is ", \
(state.empty() ? "not published yet" : state)); \
} else { \
thunk(); \
} \
} \
if constexpr (std::string_view(#
STATE) == std::string_view(
"Driving")) { \
have_never_been_engaged = false; \
} \
} \
static_assert(true)
#define STATE(IDENTIFIER)
auto start(Ts &&... xs) -> pid_t
Definition: record.hpp:40
Autoware encountered some problem that led to a simulation failure.
Definition: exception.hpp:41