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

Confirming data from multiple subscribers

asked 2021-07-29 21:23:06 -0500

sisko gravatar image

updated 2021-07-29 21:23:49 -0500

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 ?

edit retag flag offensive close merge delete

Comments

Maybe it is a doom question, but ... how about checking data directly on the publisher side, when taking the data?

Andromeda gravatar image Andromeda  ( 2021-07-30 15:04:32 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2021-08-01 02:53:35 -0500

gvdhoorn gravatar image

updated 2021-08-01 02:54:53 -0500

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.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-07-29 21:23:06 -0500

Seen: 81 times

Last updated: Aug 01 '21