Ask Your Question

How do I measure packet latency?

asked 2016-08-09 21:41:34 -0600

doullylogo gravatar image

What I want to know is how do I measure latency? Are there ROS functions that support this? More specifically, would this practice be applicable to windows?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2016-08-09 23:44:55 -0600

ahendrix gravatar image

ROS doesn't have any convenience functions for measuring latency, but it's relatively simple to get a decent latency measurement by comparing the timestamp in the header with the current time.

The accuracy of this measurement will depend on:

  • latency between the header timestamp and actual message transmission
  • the actual network latency
  • queuing latency on the receiving computer
  • any clock offset between the sending and receiving computer
  • maybe a few other factors

If you're trying to measure packet latency there's really no substitute for understanding how much latency and jitter your system can tolerate, and doing your research.

edit flag offensive delete link more

answered 2016-08-10 01:09:34 -0600

gvdhoorn gravatar image

Note: I assume you actually mean message latency, not packet latency. At least for TCPROS, there is no (guaranteed) correspondence between packets and messages.

If you are really interested in packet latency, you could a tool like Wireshark, which is well supported on multiple platforms, including Windows.

In general I agree with @ahendrix: interpreting these nrs will take some insight into the various parts of the ROS messaging pipeline.

I'd like to add though that there is at least some infrastructure that would seem to support what you are after though: Topic Statistics (added somewhere last year), with rosprofiler and the support for them in rqt_graph.

I must say that I don't know how well this is supported on Windows however.

As it is based on recent Indigo and Jade releases, you could see whether ros_cygwin includes support for it.

edit flag offensive delete link more

answered 2016-08-10 04:26:16 -0600

Marcin Bogdanski gravatar image


The closest thing would, as mentioned, Topic Statistics. TopicStatistics monitors period and stamp_age. I don't know if it is supported on windows. TopicsStatistics can be tricky to work with though, to enable topic statistics:

1) Run roscore as normal

2) Enable statistics rosparam set enable_statistics true

3) Only then start your other nodes, you will need at least one subscriber per topic you want to measure. TopicStatistics won't work on topics that have no subscribers.

4) You should see /statistics topic, which is aggregated, all nodes publish to it, so you need to filter out messages you need.

I think TopicStatistics work using timestamps in headers, which means your measures will depend on quality of these timestamps. If both your nodes are on single PC then that should be ok, if nodes span across network, or messages are being generated based on time from external hardware (like laser scanners etc), then your timestamps may be off.

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


Asked: 2016-08-09 21:41:34 -0600

Seen: 2,193 times

Last updated: Aug 10 '16