-
Notifications
You must be signed in to change notification settings - Fork 214
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
publish msg period as 1 minutes, but actually the result is lower then expect.
$ ros2 topic pub /image sensor_msgs/Image -r 10 -p 10
actually period: 1.004s.
$ ros2 topic pub /image sensor_msgs/Image -r 100 -p 100
actually period: 1.040s.
$ ros2 topic pub /image sensor_msgs/Image -r 1000 -p 1000
actually period: 1.387s.
reference debug code:
diff --git a/ros2topic/ros2topic/verb/pub.py b/ros2topic/ros2topic/verb/pub.py
index e07bdeb..431877d 100644
--- a/ros2topic/ros2topic/verb/pub.py
+++ b/ros2topic/ros2topic/verb/pub.py
@@ -101,9 +101,13 @@ def publisher(
print('publisher: beginning loop')
count = 0
+ prev = time.time()
while rclpy.ok():
count += 1
if print_nth and count % print_nth == 0:
+ interval = time.time() - prev
+ print('interval:%s' %interval)
+ prev = time.time()
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working