Ask Your Question

How to get rostopic hz average for first 5 values?

asked 2018-12-08 05:16:24 -0600

Striker gravatar image

updated 2018-12-08 11:59:58 -0600

ahendrix gravatar image

Is there a way to get the average of first values and print for rostopic hz?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-08 12:02:03 -0600

ahendrix gravatar image

Yes; you can use the -w option to set the number of samples that rostopic hz will use when calculating the topic frequency. The full list of command-line options for rostopic hz is documented on the rostopic wiki

edit flag offensive delete link more


When i run with rostopic hz -w 5, output does not stop. How to stop the output?

Striker gravatar imageStriker ( 2018-12-10 20:15:57 -0600 )edit

You can stop the output with Ctrl-C (same as other commands and when running rostopic hz normally)

ahendrix gravatar imageahendrix ( 2018-12-10 23:04:49 -0600 )edit

I'm tying this in python or shell. Basically, i am looking for the 5 set of values to run and stop by itself.

Striker gravatar imageStriker ( 2018-12-11 22:18:25 -0600 )edit

If you're working in Python I'd suggest subscribing to the topic yourself and then computing whatever metrics you want directly. Then you will have full control without trying to use multiple processes and command line arguments and string parsing.

tfoote gravatar imagetfoote ( 2018-12-11 22:27:23 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-12-08 05:16:24 -0600

Seen: 303 times

Last updated: Dec 08 '18