Ask Your Question

Why does not my image_transport ROS application work with UDP?

asked 2014-03-28 11:24:33 -0500

Javier J. Salmerón García gravatar image

I am developing a robotic application that sends raw stereo images (computer A) using the image_transport library. Another application receives them (computer B) and synchronizes the stereo pairs and camera infos. This application has always worked perfectly using the default transport hints.

Today I changed the transport layer from TCPROS to UDPROS, and now the receiver node only gets the camera infos, but not the frames. I tried changing the datagram size, the connection technology (Wifi, Gigabit...) and the computers, without any success. The smallest frame size I tested was 320x240 and the send rate was also changed to 1 Hz.

When both nodes are executed in the same computer (e.g. computer A), everything works perfectly, so I suspect that it is not a programming issue.

Any ideas? Thank you in advance

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-03-28 12:03:15 -0500

ahendrix gravatar image

Because images are very large, they will be split into many datagrams when being sent over the wire. If ANY of those datagrams are lost, the entire image is lost. This could be what is happening in your case.

Even with large datagrams (~9000 bytes with jumbo frames), your image (roughly 3202404 = 307200 bytes) will be split into ~35 packets. The chance that all of the make it (assuming 1% packet loss) is 0.99 ^ 35 = ~0.703, or 70%. If you don't have jumbo frames turned on, your datagram size will be closer to 1500 bytes, resulting in about 200 datagrams, and the chance that all of these make it is about 0.99 ^ 200 = ~0.133 or 13%. Higher packet loss rates and smaller datagrams will make this even worse.

It's also possible that something else is wrong here; perhaps datagrams are being truncated or the topic type isn't being negotiated properly.

edit flag offensive delete link more


I tried with 8x8 frames and it works. Therefore you must be right, 320x240 raw frames are to big to be sent with UDPROS.

Javier J. Salmerón García gravatar image Javier J. Salmerón García  ( 2014-03-28 13:05:55 -0500 )edit

We use theora compression to transfer 320x240 5fps video with UDP from our robot over WiFi and it has been working pretty well.

Girts L gravatar image Girts L  ( 2014-03-30 22:00:55 -0500 )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: 2014-03-28 11:24:33 -0500

Seen: 786 times

Last updated: Mar 28 '14