Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Extension Components #1023

Merged
merged 11 commits into from
Feb 1, 2023
Merged

Introduce Extension Components #1023

merged 11 commits into from
Feb 1, 2023

Conversation

jleibs
Copy link
Member

@jleibs jleibs commented Jan 31, 2023

Add your own meta-data to anything you log.

Standalone API:

    rr.log_extension_components("extension_components/point", {"confidence": 0.9})

Or optional arg for all of the existing APIs:

    rr.log_points(
        "user_components/points",
        np.array([[32, 32], [32, 96], [96, 32], [96, 96]]),
        ext={"corner": ["upper left", "lower left", "upper right", "lower right"]},
    )

Behind the scenes we track both the inferred numpy type and arrow type and thereafter use those to attempt to do type-conversions. If the conversion fails we just warn and drop the component. This gives us fairly reasonable and forgiving behavior without violating the needs of the data-store to have a single type-per-component.

The data is visible through both hover and selection:
image
Resolves: #401

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I've added a line to CHANGELOG.md (if this is a big enough change to warrant it)

@jleibs jleibs marked this pull request as ready for review January 31, 2023 23:21
@jondo2010 jondo2010 self-requested a review February 1, 2023 08:27
examples/api_demo/main.py Outdated Show resolved Hide resolved

if color:
colors = _normalize_colors([color])
comps["rerun.colorrgba"] = ColorRGBAArray.from_numpy(colors)
instanced["rerun.colorrgba"] = ColorRGBAArray.from_numpy(colors)
Copy link
Member

@emilk emilk Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems weird to me. A user can set a single color as an argument, and then it will be a splat, and should go into splats. Same with label etc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't change the behavior that was there -- just highlighted the issue. The core of what you're seeing is the fact that the arrow3d API doesn't expose batches at all. There is no "log_arrows" at the moment. I agree we should do a pass to make this consistent across the board, but this isn't the PR to do it.

Copy link
Member

@nikolausWest nikolausWest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so excited for this feature! I've been playing around with it a bit an was very pleasantly surprised that it already works so well. Because it's so useful I directly found I wanted #1024 when using it.

One thing I'd really like to change: the names "user_components" in the SDK and "user" in the Viewer.
Screenshot 2023-02-01 at 09 13 22
Screenshot 2023-02-01 at 09 12 57

I don't like the word "user", as it conveys that this is just a small corner on the side for the user's own stuff. I think we should use something like extend, extension, or extra. I also think the parameter to the logging function should be super short, perhaps even ext.

Copy link
Contributor

@jondo2010 jondo2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good stop-gap until we have the runtime component registry

@jleibs jleibs changed the title Introduce user_components Introduce Extension Components Feb 1, 2023
Copy link
Member

@nikolausWest nikolausWest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jleibs jleibs merged commit 4da1fad into main Feb 1, 2023
@jleibs jleibs deleted the jleibs/user_components branch February 1, 2023 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamically add new entity component
4 participants