ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Network data loss using 4 robots

asked 2016-03-25 01:22:40 -0500

Luis Ruiz gravatar image

updated 2016-04-26 01:29:51 -0500

I have a group of four robots. Right now I am doing testings on the data transmission over a wireless network, the output of rqt_graph is shown below.

image description

  • Robot 1, 2 and 3 are different robots sending a message.
  • Leader 1, 2 and 3 are the same leader robot running the listener 3 times.

So, I have 4 robots, 3 sending, 1 receiving. I want my application to be as real time as possible. I am running at 30 Hz. First I tough to put nothing on the stack, so the data I receive is always the newest one, the publishers and subscribers are set with a stack size of 1, but with that I lose a lot of data. The output is shown below:

  • Machine is the robot sending data
  • Message is the message number received
  • Counter is the message number expected

I print out whenever Message and Counter are different and at every second.

[ INFO] [1458884633.094665493]: Machine <0> Message<150>
[ WARN] [1458884633.249164663]: Machine <1> Message<188> Counter <186>
[ WARN] [1458884633.249326863]: Machine <1> Message<192> Counter <189>
[ INFO] [1458884633.261020475]: Machine <2> Message<270>
[ WARN] [1458884633.367932119]: Machine <0> Message<154> Counter <152>
[ WARN] [1458884633.368090775]: Machine <0> Message<158> Counter <155>
[ WARN] [1458884633.619671753]: Machine <1> Message<202> Counter <196>
[ WARN] [1458884633.720845046]: Machine <0> Message<165> Counter <163>
[ WARN] [1458884633.721000330]: Machine <0> Message<168> Counter <166>
[ INFO] [1458884633.832237240]: Machine <1> Message<210>
[ WARN] [1458884633.972283715]: Machine <2> Message<289> Counter <285>
[ WARN] [1458884633.972402930]: Machine <2> Message<291> Counter <290>
[ INFO] [1458884634.102028388]: Machine <0> Message<180>
[ WARN] [1458884634.154272541]: Machine <1> Message<217> Counter <214>
[ WARN] [1458884634.154369931]: Machine <1> Message<219> Counter <218>
[ INFO] [1458884634.262470496]: Machine <2> Message<300>
[ INFO] [1458884634.832749255]: Machine <1> Message<240>
[ WARN] [1458884635.340362798]: Machine <0> Message<215> Counter <209>
[ WARN] [1458884635.340468232]: Machine <0> Message<217> Counter <216>

Then, I tried increasing the stack to 10 elements, and the output was improved:

[ INFO] [1458885577.781345375]: Machine <0> Message<150>
[ INFO] [1458885578.197521359]: Machine <1> Message<180>
[ INFO] [1458885578.806767762]: Machine <0> Message<180>
[ INFO] [1458885578.973456886]: Machine <2> Message<240>
[ WARN] [1458885578.973578372]: Machine <2> Message<249> Counter <241>
[ INFO] [1458885579.348755549]: Machine <2> Message<270>
[ INFO] [1458885579.417701869]: Machine <1> Message<210>
[ INFO] [1458885579.781167298]: Machine <0> Message<210>
[ WARN] [1458885580.121854098]: Machine <1> Message<222> Counter <218>
[ WARN] [1458885580.121951202]: Machine <1> Message<228> Counter <223>
[ INFO] [1458885580.390034144]: Machine <1> Message<240>

If I increase the stack then I start experiencing a lag. I think I will have to do a trade between the speed in the transmission and the stack size to something that suits my application. But, I was wondering if there is a way to improve the network communication? Maybe some settings in ROS or my network that I am not taking into account.

EDIT 1

As al_dev suggested, changing to UDP improved the transmission, but now I can't get to work one detail. I am ... (more)

edit retag flag offensive close merge delete

Comments

Just an FYI: stack == queue.

gvdhoorn gravatar image gvdhoorn  ( 2016-03-25 04:29:44 -0500 )edit

@luis-ruiz, are you using TCPROS or UDPROS here?

al-dev gravatar image al-dev  ( 2016-03-28 12:29:41 -0500 )edit

I am connecting via ssh, so I think I am using TCP. I followed this tutorial

Luis Ruiz gravatar image Luis Ruiz  ( 2016-03-30 06:18:24 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-04-01 12:58:11 -0500

al-dev gravatar image

For multi-robot systems where you have a crowded network and delayed data becomes quickly irrelevant (e.g sharing position/velocities to neighbors in a swarming formation), UDP can a better choice, at the expense of less reliability.

If leader 1,2,3 are the same robot and run the same listener, you might want to try using a single node with N subscribers and a Multi-threaded spinner instead of the default ros::spin() ( http://wiki.ros.org/roscpp/Overview/C... ).

If you really cannot get the performance you want, it might be good to stress test your network without ROS to understand exactly where the bottlenecks are.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-03-25 01:22:40 -0500

Seen: 249 times

Last updated: Apr 26 '16