scenario_simulator_v2 C++ API
Classes | Namespaces | Macros
transition_assertion.hpp File Reference
#include <chrono>
#include <rclcpp/node.hpp>
#include <rclcpp/rate.hpp>
#include <scenario_simulator_exception/exception.hpp>
Include dependency graph for transition_assertion.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  concealer::TransitionAssertion< Autoware >
 

Namespaces

 concealer
 

Macros

#define DEFINE_WAIT_FOR_AUTOWARE_STATE_TO_BE(STATE)
 

Macro Definition Documentation

◆ DEFINE_WAIT_FOR_AUTOWARE_STATE_TO_BE

#define DEFINE_WAIT_FOR_AUTOWARE_STATE_TO_BE (   STATE)
Value:
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