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

When to change the buffer size parameter of advertise function

asked 2012-06-30 02:25:15 -0600

li-an gravatar image

updated 2012-07-01 10:48:35 -0600

Eric Perko gravatar image

follow:topic Tutorials

I try to change the parameter of the advertise of buffer of size.

For example,I tried 1,200,1000,2000,...etc.

But I can't find their difference.

What are the cases of changing that parameter ?

Is there any sample code ?

Thank you !!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-01-16 19:13:55 -0600

kalectro gravatar image

You will see the effect only under certain circumstances. First make sure you know what a buffer is used for, then you could try the following:

set the buffer size to 1 and publish 100 messages right after another by writing something like

for (int i=0;i<100;++i)

pub.publish(message);

This will publish the message 100 times but will most likely not be received that often. What happens is the following: If your code publishes a message, it will overwrite the last message which is still waiting in the buffer for transmission. How many messages will be received by the subscriber will depend on the network connection between the publisher and the subscriber.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-06-30 02:25:15 -0600

Seen: 1,552 times

Last updated: Jan 16 '13