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

Revision history [back]

click to hide/show revision 1
initial version

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.

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.

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.