41 std::lock_guard<std::mutex> lock(
sm_mutex_);
53 ROS_DEBUG_STREAM(
"updateRunPermitted(" << std::boolalpha << run_permitted << std::noboolalpha <<
")");
55 std::lock_guard<std::mutex> lock(
sm_mutex_);
56 state_machine_->process_event(
typename RunPermittedStateMachine::run_permitted_updated(run_permitted));
62 std_srvs::SetBool::Response &res)
71 std::unique_lock<std::mutex> sm_lock(
sm_mutex_);
bool updateRunPermittedCallback(std_srvs::SetBool::Request &req, std_srvs::SetBool::Response &res)
Stop1Executor(const TServiceCallFunc &hold_func, const TServiceCallFunc &unhold_func, const TServiceCallFunc &recover_func, const TServiceCallFunc &halt_func)
Create required service clients and state machine; start worker-thread and state machine.
std::atomic_bool terminate_
Flag indicating if the worker-thread should terminate.
std::condition_variable worker_cv_
Condition variable for notifying a waiting worker-thread.
void updateRunPermitted(const bool run_permitted)
This is called everytime an updated run_permitted value is obtained.
std::thread worker_thread_
Worker-thread.
void stopStateMachine()
Stop the state machine.
#define ROS_DEBUG_STREAM(args)
void workerThreadFun()
This is executed in the worker-thread and allows asynchronous handling of run_permitted updates...
void execute()
Execute the task.
std::function< bool()> TServiceCallFunc
msm::back::state_machine< RunPermittedStateMachine_ > RunPermittedStateMachine
The top-level (back-end) state machine.
An AsyncRunPermittedTask is represented by a task execution and a completion signalling.
void signalCompletion()
Signal completion of the task execution.
std::unique_ptr< RunPermittedStateMachine > state_machine_
State machine.
virtual ~Stop1Executor()
Stop state machine and terminate worker-thread.