15template <
typename TopicT>
34 const std::string& topic_name)
41 topic_name, 10, [
this](
const typename TopicT::SharedPtr msg) { this->
callback(msg); });
48 virtual void stop(
const std::string& bond_id,
const std::string& instance_id =
"")
override
60 throw runner_exception(
"cannot stop runner subscriber that was not started");
65 RCLCPP_INFO(
node_->get_logger(),
"runner cleaned. stopping..");
90 RCLCPP_INFO(
node_->get_logger(),
"Waiting for Message.");
94 RCLCPP_INFO(
node_->get_logger(),
"Message Received.");
103 RCLCPP_ERROR(
node_->get_logger(),
"Message receiving failed.");
108 RCLCPP_INFO(
node_->get_logger(),
"Thread closing.");
120 void callback(
const typename TopicT::SharedPtr& msg)
141 std::condition_variable
cv_;
virtual capabilities2_events::EventParameters param_on_success()
Update on_success event parameters with new data if available.
Definition runner_base.hpp:271
void emit_succeeded(const std::string &bond_id, const std::string &instance_id, capabilities2_events::EventParameters parameters=capabilities2_events::EventParameters())
emit SUCCEEDED event
Definition runner_base.hpp:444
void emit_failed(const std::string &bond_id, const std::string &instance_id, capabilities2_events::EventParameters parameters=capabilities2_events::EventParameters())
emit FAILED event
Definition runner_base.hpp:457
virtual capabilities2_events::EventParameters param_on_started()
Update on_started event parameters with new data if available.
Definition runner_base.hpp:226
void init_base(rclcpp::Node::SharedPtr node, const runner_opts &run_config)
Initializer function for initializing the base runner in place of constructor due to plugin semantics...
Definition runner_base.hpp:126
virtual capabilities2_events::EventParameters param_on_stopped()
Update on_stopped event parameters with new data if available.
Definition runner_base.hpp:241
virtual capabilities2_events::EventParameters param_on_failure()
Update on_failure event parameters with new data if available.
Definition runner_base.hpp:256
rclcpp::Node::SharedPtr node_
shared pointer to the capabilities node Allows to use ros node related functionalities
Definition runner_base.hpp:469
void emit_started(const std::string &bond_id, const std::string &instance_id, capabilities2_events::EventParameters parameters=capabilities2_events::EventParameters())
emit STARTED event
Definition runner_base.hpp:418
void emit_stopped(const std::string &bond_id, const std::string &instance_id, capabilities2_events::EventParameters parameters=capabilities2_events::EventParameters())
emit STOPPED event
Definition runner_base.hpp:431
add threaded trigger execution to the runner
Definition threadtrigger_runner.hpp:21
static const std::string bond_from_thread_id(const std::string &thread_id)
helper function to extract bond_id from thread_id
Definition threadtrigger_runner.hpp:30
static const std::string instance_from_thread_id(const std::string &thread_id)
helper function to extract instance_id from thread_id
Definition threadtrigger_runner.hpp:44
Topic runner base class.
Definition topic_runner.hpp:17
TopicT::SharedPtr latest_message_
parameter to store the latest message received in the callback for use in the trigger execution
Definition topic_runner.hpp:136
virtual void stop(const std::string &bond_id, const std::string &instance_id="") override
stop function to cease functionality and shutdown
Definition topic_runner.hpp:48
bool completed_
Definition topic_runner.hpp:143
rclcpp::Subscription< TopicT >::SharedPtr subscription_
parameter to be used in the on_started event emission
Definition topic_runner.hpp:131
virtual void init_subscriber(rclcpp::Node::SharedPtr node, const runner_opts &run_config, const std::string &topic_name)
Initializer function for initializing the topic runner in place of constructor due to plugin semantic...
Definition topic_runner.hpp:33
void callback(const typename TopicT::SharedPtr &msg)
Callback to be executed when receiving a message.
Definition topic_runner.hpp:120
virtual void execution(capabilities2_events::EventParameters parameters, const std::string &thread_id) override
Trigger process to be executed.
Definition topic_runner.hpp:77
std::condition_variable cv_
condition variable and mutex for synchronizing the callback and trigger execution
Definition topic_runner.hpp:141
TopicRunner()
Constructor which needs to be empty due to plugin semantics.
Definition topic_runner.hpp:22
std::mutex block_mutex_
Definition topic_runner.hpp:142
Definition action_runner.hpp:19
capability options for a capability runner given by interface and provider
Definition event_parameters.hpp:167
runner exception
Definition runner_base.hpp:24
runner options
Definition runner_base.hpp:56