Skip to content

Commit 6e03cf8

Browse files
author
Devis Dal Moro
committed
Resolve first msg lost issue on sub
1 parent 4236b82 commit 6e03cf8

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

behaviortree_ros2/include/behaviortree_ros2/bt_topic_sub_node.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ inline RosTopicSubNode<T>::SubscriberInstance::SubscriberInstance(
181181
broadcaster(msg);
182182
};
183183
subscriber = node->create_subscription<T>(topic_name, 1, callback, option);
184+
callback_group_executor.spin_some(std::chrono::milliseconds(0));
184185
}
185186

186187
template <class T>

behaviortree_ros2/include/behaviortree_ros2/serialized_sub_node.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace BT
3232

3333
bool latchLastMessage() const override
3434
{
35-
return consume_msgs_;
35+
return !consume_msgs_;
3636
}
3737
void fetchSubscriberValues()
3838
{

0 commit comments

Comments
 (0)