Skip to content

Commit 16baeb5

Browse files
committed
fix
1 parent 3ccd2e7 commit 16baeb5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

behaviortree_ros2/include/behaviortree_ros2/bt_topic_sub_node.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,20 +249,19 @@ inline bool RosTopicSubNode<T>::createSubscriber(const std::string& topic_name)
249249
// find SubscriberInstance in the registry
250250
std::unique_lock lk(registryMutex());
251251

252-
auto shared_node = node_.lock();
252+
auto node = node_.lock();
253253
if(!node)
254254
{
255255
throw RuntimeError("The ROS node went out of scope. RosNodeParams doesn't take the "
256256
"ownership of the node.");
257257
}
258-
subscriber_key_ =
259-
std::string(shared_node->get_fully_qualified_name()) + "/" + topic_name;
258+
subscriber_key_ = std::string(node->get_fully_qualified_name()) + "/" + topic_name;
260259

261260
auto& registry = getRegistry();
262261
auto it = registry.find(subscriber_key_);
263262
if(it == registry.end() || it->second.expired())
264263
{
265-
sub_instance_ = std::make_shared<SubscriberInstance>(shared_node, topic_name);
264+
sub_instance_ = std::make_shared<SubscriberInstance>(node, topic_name);
266265
registry.insert({ subscriber_key_, sub_instance_ });
267266

268267
RCLCPP_INFO(logger(), "Node [%s] created Subscriber to topic [%s]", name().c_str(),

0 commit comments

Comments
 (0)