Confirming data from multiple subscribers
Is there a ROS technique for ignoring subscriber generated data if it is empty or deemed incorrect ?
My robot model has 3 lasers with the possibility of more to come. My code has 3 distinct subscribers subscribing to the left, front and right lasers on my robot. The subscribers do work but I am constantly encountering issues where one or more of them returns an empty tuple. The empty tuple(s) mess up the rest of my code.
I have an if statement to check that my subscriber generated tuples are not empty but I am still encountering problems.
I’m trying to find a way of aborting empty tuples which waits for the subscribers to return some legitimate data. Can anyone help, please ?
Asked by sisko on 2021-07-29 21:23:06 UTC
Answers
Is there a ROS technique for ignoring subscriber generated data if it is empty or deemed incorrect ?
this would be difficult, even without ROS: how would a generic, reusable framework determine whether something is incorrect in all situations it gets (re)used in?
It would need an oracle telling it what it should consider correct or not. Such an oracle could be implemented in the form of a predicate, which returns true or false (or some more high-dimensional representation of truth). And such predicates could be implemented as functions in general purpose programming languages (such as C/C++, etc).
Seeing as you are the only one who knows what would be correct (or well-formed) data in your application, you would need to write such a predicate, and you'd need to include it in all consumers of your data.
It seems you have something like that, as you write:
I have an if statement to check that my subscriber generated tuples are not empty [..]
This would be the way to do it.
Concretely: I'm not aware of a generic piece of infrastructure into which you could plug-in a predicate telling the ROS middleware whether a message should be considered to be well-formed. If data correctness is an issue, it would be best to check it on the producing side, or indeed in each of your consumers (ie: subscribers).
The subscribers do work but I am constantly encountering issues where one or more of them returns an empty tuple.
This confuses me: subscription callbacks do not "return tuples" (or anything really). They are void functions.
Asked by gvdhoorn on 2021-08-01 02:53:35 UTC
Comments
Maybe it is a doom question, but ... how about checking data directly on the publisher side, when taking the data?
Asked by Andromeda on 2021-07-30 15:04:32 UTC