Ask Your Question
0

Rate time of ROS code

asked 2018-02-23 06:08:07 -0600

JuanTelo gravatar image

updated 2018-02-23 06:17:40 -0600

Hi, is there a way to see how much time my code is taking to run? I don't mean elapsed time but the rate it is working. For example, I have three topics being published and one subscriber and I want to know how the rate at which they are being published.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-02-23 06:14:11 -0600

You can use rqt_graph to find out the frequency at which messages are being published to your topics. First enable statistics with the following command:

rosparam set enable_statistics true

Then execute rqt_graph as described here.

I'm not quite sure what time you're trying to measure when you say "how much time it takes for the topics to be published" if you don't mean elapsed time. can you clarify this.

edit flag offensive delete link more

Comments

You're right, sorry for not being clear in the question, I've edited and will try your answer

JuanTelo gravatar imageJuanTelo ( 2018-02-23 06:18:08 -0600 )edit

Should I write that command in the command line? while rqt is open? because I tried it and still the same, nothing has appeared

JuanTelo gravatar imageJuanTelo ( 2018-02-23 06:19:16 -0600 )edit

While your code is running open a new terminal and enter the first command I described. Then on the next line start rqt_graph. This should show a graph of all the nodes, which topics they're publishing and the frequency at which they're being published.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2018-02-23 13:46:38 -0600 )edit
0

answered 2018-02-23 07:05:06 -0600

Delb gravatar image

updated 2018-02-23 07:07:09 -0600

Just run all your topics and then execute rostopic hz /topic_name. You can also have multiple topics at the same time : rostopic hz /topic_0 /topic_1 /topic_2

edit flag offensive delete link more

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

Stats

Asked: 2018-02-23 06:08:07 -0600

Seen: 119 times

Last updated: Feb 23 '18