42 const std::string& name,
44 bool default_continuous_value,
double default_timeout)
57 std_msgs::msg::String msg;
65 std::string keep_open_param =
name_ +
"_continuous";
66 if (!
node_->has_parameter(keep_open_param))
68 node_->declare_parameter(keep_open_param, rclcpp::ParameterType::PARAMETER_BOOL);
71 node_->get_parameter_or(keep_open_param, keep_open, default_continuous_value);
73 std::string timeout_param =
name_ +
"_timeout";
74 if (!
node_->has_parameter(timeout_param))
76 node_->declare_parameter(timeout_param, rclcpp::ParameterType::PARAMETER_DOUBLE);
79 node_->get_parameter_or(timeout_param, d_timeout, default_timeout);
80 rclcpp::Duration timeout = rclcpp::Duration::from_seconds(d_timeout);
84 RCLCPP_ERROR_ONCE(
node_->get_logger(),
85 "Could not find parameter %s and did not receive %s via std_msgs::msg::String subscription "
123 const auto nd_name = std::string(
node_->get_name()).append(
"_ssp_").append(
name_);
124 const auto temp_node = std::make_shared<rclcpp::Node>(nd_name);
127 rclcpp::QoS(1).transient_local().reliable(),
128 [
this](
const std_msgs::msg::String::ConstSharedPtr& msg) {
return stringCallback(msg); });
130 rclcpp::WaitSet wait_set;
133 auto ret = wait_set.wait(timeout.to_chrono<std::chrono::duration<double>>());
134 if (ret.kind() == rclcpp::WaitResultKind::Ready)
136 std_msgs::msg::String msg;
137 rclcpp::MessageInfo info;