Skip to content

Wait for all registered transformations to become available #11

Description

@mintar

The current implementation of transformer does not wait until it can resolve all registered transformations before firing the callbacks. To illustrate this problem (and what I expected would happen), I've added a test case here (which fails, of course):

BOOST_AUTO_TEST_CASE( callback_only_when_tf_available )

So what's happening here?
With each new pushDynamicTransformation() call, transformer registers a new stream with the aggregator. When the first data sample arrives, it triggers the callback, regardless of whether the registered transformations are available or not.

Since it fired too soon, the data sample is already gone when the missing transformation finally arrives.

This can go on for a long time, e.g. if a robot arm driver has not yet been started up, so there are no joint states from that arm (and therefore no transforms). Once transformer has seen all transforms at least once, it behaves correctly, and registered transformations are always available within the callback.

What did I expect would happen?
I expected transformer would check if all registered transformations were available and only triggered the callback then. See test case.

Why would it be nice if that behavior would change?

  1. The client wouldn't have to check for failed transformations. It could assume that all transformations are available when the callback is called.
  2. Transformer wouldn't throw away perfectly good samples in the beginning because it fired too soon.

This behavior totally puzzled me and took me forever to figure out; also because it's undocumented of course. So I would be happy with either of those solutions (most desirable first):

  1. Change the default behavior of transformer. I don't see a use case where somebody would want the old behavior.
  2. Add a parameter to registerDataStreamWithTransform() to switch it to the new behavior.
  3. Clearly document that the callback will be called regardless of whether the transformations are available or not, so that the client knows they have to double-check this in their own code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions