Ask Your Question

Plotting lag, jitter, bandwidth and frequency of topics, how to?

asked 2013-03-26 04:22:41 -0600

Claudio gravatar image

updated 2013-03-26 04:23:19 -0600

I would like to plot the mentioned data during an experiment for one or more topics and nodes.

Is there a way I can do that?

I tried rxplot but it wants a message's field.

I could go as far as writing a node to publish all this data as messages, but since this data is shown (not published) by a mixture of rostopic and tfmonitor how would I go at collecting the data itself?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-03-26 06:15:10 -0600

jbohren gravatar image

updated 2013-03-26 10:06:24 -0600

I started putting together some tools for measuring these types of statistics and then publishing them out over ros topics themselves. I also wrote an rviz modified camera plugin which performs the statistics without creating an additional camera socket connection.

I only implemented stats for latency and message loss, but it shouldn't be hard to add features to estimate jitter and bandwidth, too.

See the readme for more information and an example:

edit flag offensive delete link more


Thanks, I'll have a look.

Claudio gravatar imageClaudio ( 2013-03-26 06:19:41 -0600 )edit

Cloned your code but it refuses to build. What release did you base it on? rosbuild, catkin, rosmake? I'm stuck on fuerte right now as groovy had all sorts of problems compiling on arm.

Claudio gravatar imageClaudio ( 2013-03-26 06:29:41 -0600 )edit

It builds for me on fuerte, where is the build failing?

jbohren gravatar imagejbohren ( 2013-03-26 06:35:30 -0600 )edit

If you're trying to compile this for ARM, you might want to remove the deps from the manifest related to the rviz plugin, and then remove the rviz plugin from the CMakeLists. Really this package should be split into two:

jbohren gravatar imagejbohren ( 2013-03-26 06:39:20 -0600 )edit

No no i'm trying it on x86. i get a cmake fail on "moc_camera_display.cxx assuming it will be generated later" and

Claudio gravatar imageClaudio ( 2013-03-26 06:45:40 -0600 )edit

File "/opt/ros/fuerte/lib/python2.7/dist-packages/roslib-1.8.10-py2.7.egg/roslib/", line 318, in get_dependencies raise MsgSpecException("Cannot load type %s. Perhaps the package is missing a dependency."%(str(e)))

Claudio gravatar imageClaudio ( 2013-03-26 06:46:09 -0600 )edit

roslib.msgs.MsgSpecException: Cannot load type 'lcsr_nettools/TopicMeasurements'. Perhaps the package is missing a dependency.

i manually checked every dependency in the manifest and I'm not missing any.

Claudio gravatar imageClaudio ( 2013-03-26 06:46:24 -0600 )edit

If you're having trouble building the QT stuff (probably missing deps) and don't care about the rviz camera plugin, you can just remove the add_subdirectory(rviz_plugins from CmakeLists.txt

jbohren gravatar imagejbohren ( 2013-03-26 06:48:28 -0600 )edit

answered 2013-03-26 05:36:47 -0600

SL Remy gravatar image

I think most of what you're asking for can be done with rostopic:

rostopic bw display bandwidth used by topic
rostopic hz display publishing rate of topic    
rostopic echo   print messages to screen

Code would be needed for the output of rostopic echo -p /topic. From this you can use any language of your choice to determine jitter in the timestamp of message.

Lag would have to be derived by some type of time difference.. so without more information I have no suggestions for that one.

edit flag offensive delete link more


Mmm, I'm actually thinking about saving rostopic and tf_monitor output data to files, then parse and plot these files with matlab. But I hoped there was something easier.

Claudio gravatar imageClaudio ( 2013-03-26 05:53:33 -0600 )edit

If your data is stamped, you could compute lag as the duration between the data timestamp and the time at which the subscriber callback is serviced. Make sure that your spinner thread is fast enough to not introduce significant measurement errors.

Adolfo Rodriguez T gravatar imageAdolfo Rodriguez T ( 2013-03-26 05:57:42 -0600 )edit

Also, what are the expected/typical frequencies, lags, jitters in your application?

Adolfo Rodriguez T gravatar imageAdolfo Rodriguez T ( 2013-03-26 06:00:14 -0600 )edit

Frequencies below 10Hz, lags and jitters I don't know. That's why I want to plot them. I work on a fleet of vehicles controlled with ROS over wifi. So I'm thinnking about running the core on a single machine to collect data for comparison, then progressively include more elements and save each step.

Claudio gravatar imageClaudio ( 2013-03-26 06:14:56 -0600 )edit

And eventually plot everything and see what comes out: if varying the number of robots affects lag and/or bandwidth, or what changes when scaling up the number of nodes. Or if the same nodes over different machines change the results and how compared to the same nodes on a single machine.

Claudio gravatar imageClaudio ( 2013-03-26 06:16:14 -0600 )edit

Frequencies in the order of 10Hz seem OK to monitor with ros topics and the existing tools.

Adolfo Rodriguez T gravatar imageAdolfo Rodriguez T ( 2013-03-26 06:24:47 -0600 )edit

@Claudio piping to a file is easy `rostopic echo -p /odom/pose/pose/position > myRobotLocation and the loading is easy in most languages (skip the first and last lines, and double check that each line of data ends with a newline)

SL Remy gravatar imageSL Remy ( 2013-03-27 11:35:22 -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


Asked: 2013-03-26 04:22:41 -0600

Seen: 2,294 times

Last updated: Mar 26 '13