Ask Your Question
0

What it the ROS way to represent invalid data in a message

asked 2014-11-24 06:26:01 -0500

techno74 gravatar image

I have a sensor that outputs static or slowly changing data at a low rate and dynamically changing data at a higher rate.

I would like to have one message that aggregates this data together but doesn't have to wait for a 'static data' update before it publishes the first message (due to the lossy medium these messages come over it may never get one).

I'm looking for a way that a subscriber can tell which fields of the message are populated and which are not.

The options so far:

  1. Have a bitfield that holds whether each field is valid or not.
  2. Have pre-defined invalid values as default values for each field.
  3. Represent each value as an array of the corresponding message type and publish an array of length 0 or 1.

Am I missing a ROS way to specify that a field in a message is optional or invalid?

Unfortunately it's not as simple as just having a seperate message for static vs. dynamic data because depending on the source of the data some fields in each of those messages may also be omitted...

For interest I am trying to integrate an AIS receiver ( http://en.wikipedia.org/wiki/Automati... )

edit retag flag offensive close merge delete

Comments

I'd say: It depends. Can you come up with an exemplary message for your data + comments which kind of data might not be filled? I have seen 2) and 3) being used in standard messages.

dornhege gravatar image dornhege  ( 2014-11-24 08:34:33 -0500 )edit

3 Answers

Sort by » oldest newest most voted
1

answered 2014-11-24 06:42:38 -0500

Wolf gravatar image

I don't think there is a "ROS-way" for doing this. I presume you can figure this out yourself, I cannot add something to your options list. A "shared-pointer-like" field which can optionally be populated is not included in the ROS msg format.

Addition on your 2) option: If your data never contains zeros maybe it be smart to use this one and check the received data for non-zero, because all ros message field are defaulted in the constructor to zero (or false for booleans).

edit flag offensive delete link more

Comments

I think the invalid default values is probably the way to go in this case. Thanks.

techno74 gravatar image techno74  ( 2014-12-02 11:13:26 -0500 )edit
1

answered 2014-11-24 08:07:39 -0500

Tom Moore gravatar image

The NavSatFix message uses NaNs to represent altitudes that aren't available from the sensor.

edit flag offensive delete link more
0

answered 2014-12-02 10:29:19 -0500

techno74 gravatar image

What about defining 'Stamped' versions of all the fields and composing a message containing only them? Values stamped with time 0 have never been set. This allows the client to decide at what age a value becomes invalid and still get access to older values if they join the party late.

I guess the frequency of publication will determine if the overhead is too much.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-11-24 06:26:01 -0500

Seen: 586 times

Last updated: Dec 02 '14