Robotics StackExchange | Archived questions

default message handling

Hello everybody, I would like to know if there is a way to handle default values messages. Here is the situation. I have a subscriber and a publisher both written in c++ that read and write at different speeds. The publisher is very slow with respect to the subscriber. Since the subscriber if very fast happens often that the topic is empty. This causes the retrieval of continuous default messages that are very ambiguous (the string is default set to "0" and this is actually a problem) is there a way to check if the topic is empty and throw away the message? thanks Andrea

Asked by Mago Nick on 2014-04-03 10:03:41 UTC

Comments

I'm not sure if I follow. If there is no message on the topic, your subscriber will not receive an empty one, not matter how "fast" it is. Maybe show some code to illustrate what you are doing.

Asked by demmeln on 2014-04-03 14:44:03 UTC

If there is no message on a topic the subscriber gets a default value of the type of message it is looking for. I am adding some code in the question

Asked by Mago Nick on 2014-04-03 21:24:09 UTC

@demmein yes you were right. It was a side effect of some other code. Sorry for the silly question ;)

Asked by Mago Nick on 2014-04-03 21:28:10 UTC

If your problem is solved please mark your question as closed or something similar!

Asked by BennyRe on 2014-04-04 00:35:42 UTC

Yes, I forgot. Thanks for reminding

Asked by Mago Nick on 2014-04-04 00:54:15 UTC

Answers