0
$\begingroup$

Rosanswers logo

Hi there,

I am trying to get the video stream from camera of robot via UDP connection. I use follow subscriber;

ros::Subscriber sub_image = nh.subscribe("get/image", 1, imageCallback, ros::TransportHints().udp());

This code should select UDP connection.
However, bellow message sometimes appears.

a message of over a gigabyte was predicted in tcpros...

And, I checked the connection status by ping, but UDP connection was not used.
How do I set connection as UDP and check connection setting? I think ros::TransportHints().udp() is not enough to do that.

Thanks in advance,
Keiya


Originally posted by Keiya on ROS Answers with karma: 51 on 2011-11-24

Post score: 5

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

If you are transmitting uncompressed images, UDP is probably a bad idea anyway, especially if anything wireless is involved.

A 640x480 image with RGBA color amounts to 1.2M data. Assuming a frame size of 1500 bytes per packet, you have to transmit about 820 packets per image. UDP has no fail-safe for transmission errors. Assuming a packet loss rate of 0.1%, you have just a 44 percent (0.999^820) chance of transmitting a single image intact.


Originally posted by roehling with karma: 1951 on 2011-11-27

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by roehling on 2011-11-28:
You could limit the subscriber queue size, or even better, throw away frames which are too old based on the message timestamp.

Comment by Keiya on 2011-11-27:
I am transmitting compressed image by image_transport republisher. The reason why I am trying to use UDP is that I do not care about frames of what happened seconds ago. But anyway, thank you for your advice!

$\endgroup$
0
$\begingroup$

Rosanswers logo

I think this is the right way to use UDP. However, I had troubles too with UDP when dealing with images. It seems that the UDP code is much more unstable than the TCP one. So for now I reverted to using TCP as I am lacking time to investigate further.


Originally posted by Thomas with karma: 4478 on 2011-11-27

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by Thomas on 2011-11-28:
Yes, I got it on Diamondback, I did not try again using Electric since.

Comment by Keiya on 2011-11-27:
Do you also find the message "a message of over a gigabyte was predicted in tcpros..."?

$\endgroup$
0
$\begingroup$

Rosanswers logo

One reason that setting udp but getting TCP is that it is only a transport hint, i.e., if UDP isn't available for some reason, it will fallback to TCP. Maybe that is what happened.


Originally posted by dornhege with karma: 31395 on 2011-11-28

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by dornhege on 2011-11-28:
It's just a possible reason. As far as the documentation goes you cannot force this on the ROS site, but it should be taken if possible.

Comment by Keiya on 2011-11-28:
You mean that I should do something except transport hint, do you? OK, I will check what is happened in my computer and network.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.