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

Messages lost in ROS ELECTRIC

asked 2012-05-17 22:10:06 -0600

McMurdo gravatar image

Why do certain message packets get lost? Is this normal? I have attached a image for reference. Clearly, packets 0,1,2 were lost.

Please help image description

edit retag flag offensive close merge delete

Comments

This problem is similar to another one, which also detailed solutions: http://answers.ros.org/question/11167/how-do-i-publish-exactly-one-message/

Benoit Larochelle gravatar image Benoit Larochelle  ( 2012-11-14 01:01:30 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
5

answered 2012-05-18 03:00:58 -0600

Lorenz gravatar image

You lose only the first few messages. This probably doesn't have anything to do with buffer sizes but that subscribing takes a while. Your publisher node always publishes something although the connection to your subscriber is not completely established yet. This behavior directly follows from the way ros works.

Normally nodes are written in a way that this doesn't matter. However, roscpp provides callbacks when nodes subscribe or unsubscribe (connect_cb and disconnect_cb as shown here) and you can get the number of subscribed nodes from the publisher object. That way, the publisher can start publishing only when the subscriber is present.

Latched topics are used more commonly though. With a latched topic, the subscriber always receives the newest message that has been published right after the connection to the publisher is established.

edit flag offensive delete link more

Comments

This definitely seems to be the case, not the queue stuff I mention in my answer. :)

Miguel Prada gravatar image Miguel Prada  ( 2012-05-20 07:12:37 -0600 )edit
Meet H Thakkar gravatar image Meet H Thakkar  ( 2020-03-06 15:13:04 -0600 )edit
0

answered 2012-05-17 23:01:28 -0600

Miguel Prada gravatar image

Depending on the queue size you define on your publisher (or subscriber), and the rate at which you are publishing (or processing the incoming messages) it is perfectly possible that the publisher (or subscriber) is dropping messages.

Try to increase the publisher and subscriber queue sizes and see if this still happens.

edit flag offensive delete link more

Comments

As an addition: the underlying TCP stack might drop packages as well depending on the quality of your network and traffic.

Lorenz gravatar image Lorenz  ( 2012-05-17 23:02:59 -0600 )edit

Quality of network? I am doing both the processes on the same computer!

McMurdo gravatar image McMurdo  ( 2012-05-18 02:49:51 -0600 )edit

Ok. You didn't mention that in your question.

Lorenz gravatar image Lorenz  ( 2012-05-18 02:51:17 -0600 )edit

I am sorry, I thought it was apparent from the terminal outputs. Thanks a lot for helping me out.

McMurdo gravatar image McMurdo  ( 2012-05-20 19:45:37 -0600 )edit

I solved it! Super Answer, @Lorenz

McMurdo gravatar image McMurdo  ( 2012-05-20 21:10:50 -0600 )edit

Question Tools

Stats

Asked: 2012-05-17 22:10:06 -0600

Seen: 1,599 times

Last updated: May 18 '12