-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better origin heuristics for "Add entities to new space view" (#5423)
### What Follow up to #5411. This PR provides a better heuristics for the the default space origin with 2D and 3D space view. See the original PR for the (updated) design decision section. ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/5423/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/5423/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/5423/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/5423) - [Docs preview](https://rerun.io/preview/d50861028fe4f09576a16ed46196c04bf4e5dd04/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/d50861028fe4f09576a16ed46196c04bf4e5dd04/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
- Loading branch information
Showing
6 changed files
with
200 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
tests/python/release_checklist/check_context_menu_suggested_origin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
from __future__ import annotations | ||
|
||
import math | ||
import os | ||
from argparse import Namespace | ||
from uuid import uuid4 | ||
|
||
import numpy as np | ||
import rerun as rr | ||
|
||
README = """ | ||
# Context Menu - Test the origin selection heuristics | ||
Right click on each of the following entities and check that for the given space view class, the resulting suggested origin is as expected. | ||
```plaintext | ||
ENTITY CLASS EXPECTED ORIGIN | ||
/ 3D / | ||
/world 3D /world | ||
/world/camera 3D /world | ||
/world/camera/image 3D /world | ||
/world/camera/keypoint 3D /world | ||
/world 2D <not suggested> | ||
/world/camera 2D <not suggested> | ||
/world/camera/image 2D /world/camera/image | ||
/world/camera/keypoint 2D /world/camera/image | ||
``` | ||
""" | ||
|
||
|
||
def log_readme() -> None: | ||
rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), timeless=True) | ||
|
||
|
||
def log_some_space_views() -> None: | ||
rr.set_time_sequence("frame_nr", 0) | ||
rr.log("/", rr.Boxes3D(centers=[0, 0, 0], half_sizes=[1, 1, 1])) | ||
rr.log("/world", rr.ViewCoordinates.RIGHT_HAND_Y_DOWN, timeless=True) | ||
rr.log( | ||
"/world/camera/image", | ||
# rr.Pinhole(fov_y=0.7853982, aspect_ratio=1, camera_xyz=rr.ViewCoordinates.RUB, resolution=[10, 10]), | ||
rr.Pinhole( | ||
resolution=[10, 10], | ||
focal_length=[4, 4], | ||
principal_point=[5, 5], | ||
), | ||
) | ||
rr.log("/world/camera/image", rr.Image(np.random.rand(10, 10, 3))) | ||
rr.log("/world/camera/image/keypoint", rr.Points2D(np.random.rand(10, 2) * 10, radii=0.5)) | ||
|
||
for i in range(100): | ||
rr.set_time_sequence("frame_nr", i) | ||
angle = 2 * math.pi * i / 100 | ||
|
||
rr.log( | ||
"/world/camera", | ||
rr.Transform3D( | ||
rr.TranslationRotationScale3D( | ||
translation=[math.cos(angle), math.sin(angle), 0], | ||
rotation=rr.RotationAxisAngle(axis=[0, 0, 1], angle=angle), | ||
) | ||
), | ||
) | ||
|
||
|
||
def run(args: Namespace) -> None: | ||
# TODO(cmc): I have no idea why this works without specifying a `recording_id`, but | ||
# I'm not gonna rely on it anyway. | ||
rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4()) | ||
|
||
log_readme() | ||
log_some_space_views() | ||
|
||
|
||
if __name__ == "__main__": | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description="Interactive release checklist") | ||
rr.script_add_args(parser) | ||
args = parser.parse_args() | ||
run(args) |