Skip to content

Commit

Permalink
[jsk_topic_tools] Add reset option to use boolean_node with rosbag
Browse files Browse the repository at this point in the history
  • Loading branch information
nakane11 committed Dec 14, 2023
1 parent 7cca4cb commit 5034f14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/jsk_topic_tools/scripts/boolean_node.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ Parameters

Number of input. ``~number_of_input`` should be greater than 0.

* ``~reset`` (Bool, Default: ``False``)

Reset timer when ROS time moves backwards. Set ``True`` if you run the node with rosbag loop.

Example
-------
Expand Down
3 changes: 2 additions & 1 deletion jsk_topic_tools/scripts/boolean_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def __init__(self):
if rate == 0:
rospy.logwarn('You cannot set 0 as the rate; change it to 100.')
rate = 100
rospy.Timer(rospy.Duration(1.0 / rate), self.timer_cb)
reset = rospy.get_param('~reset', False)
rospy.Timer(rospy.Duration(1.0 / rate), self.timer_cb, reset=reset)

def callback(self, topic_name, msg):
if isinstance(msg, rospy.msg.AnyMsg):
Expand Down

0 comments on commit 5034f14

Please sign in to comment.