Skip to content

Commit 47d60b9

Browse files
committed
refactor: change name of retention method to latchLastMessage
1 parent e85eb03 commit 47d60b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

behaviortree_ros2/include/behaviortree_ros2/bt_topic_sub_node.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ class RosTopicSubNode : public BT::ConditionNode
175175
*/
176176
virtual NodeStatus onTick(const std::shared_ptr<TopicT>& last_msg) = 0;
177177

178-
/** Clear the message that has been processed. If returns true and no new message is
179-
* received, before next call there will be no message to process. If returns false,
178+
/** latch the message that has been processed. If returns false and no new message is
179+
* received, before next call there will be no message to process. If returns true,
180180
* the next call will process the same message again, if no new message received.
181181
*
182182
* This can be equated with latched vs non-latched topics in ros 1.
183183
*
184-
* @return true will clear the message after ticking/processing.
184+
* @return false will clear the message after ticking/processing.
185185
*/
186-
virtual bool clearProcessedMessage() { return true; }
186+
virtual bool latchLastMessage() const { return false; }
187187

188188
private:
189189

@@ -317,7 +317,7 @@ template<class T> inline
317317
};
318318
sub_instance_->callback_group_executor.spin_some();
319319
auto status = CheckStatus (onTick(last_msg_));
320-
if (clearProcessedMessage())
320+
if (!latchLastMessage())
321321
{
322322
last_msg_.reset();
323323
}

0 commit comments

Comments
 (0)