Ask Your Question
0

Data loss between publisher and subscriber

asked 2017-10-03 17:15:12 -0600

_nobot.enter gravatar image

Hello

I was running ROS package with one publisher and subscriber in below link. https://github.com/oroca/oroca_ros_tu...

Basically, publisher sends a number (add 1 every loop) and subscriber gets it.

So, I run subscriber first, then run publisher in a different terminal.
Then I could see that there was a loss.

Publisher starts with 0, but Subscriber gets from 3.

Is this normal? Is this solvable?

Thank you in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-10-05 04:21:17 -0600

When a publisher is created, there is some setup performed "behind the scenes", such as registering with the ROS Master and potential subscribers. This means that when one publishes immediately after creation of the publisher, messages might not actually get out because the Publisher wasn't "ready" yet. See for instance also other Q/As such as this one. Pretty sure that adding a sleep here in line 13 would fix the issue.

edit flag offensive delete link more

Comments

Thanks Stefan Kohlbrecher :D

_nobot.enter gravatar image_nobot.enter ( 2017-10-05 13:50:17 -0600 )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

2 followers

Stats

Asked: 2017-10-03 17:15:12 -0600

Seen: 72 times

Last updated: Oct 05 '17