From b1dc31c4bc60b83f6ad574e1cea00911af5cbd82 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 17 Jan 2025 07:55:32 +0100 Subject: [PATCH 1/4] Add missing feature flags to arrow2, to fix CI (#8720) --- crates/utils/re_arrow_util/Cargo.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/utils/re_arrow_util/Cargo.toml b/crates/utils/re_arrow_util/Cargo.toml index 68a36945c59d..126ecf1d831c 100644 --- a/crates/utils/re_arrow_util/Cargo.toml +++ b/crates/utils/re_arrow_util/Cargo.toml @@ -27,5 +27,9 @@ re_log.workspace = true re_tracing.workspace = true arrow.workspace = true -arrow2.workspace = true +arrow2 = { workspace = true, features = [ + "compute_concatenate", + "compute_filter", + "compute_take", +] } itertools.workspace = true From cae7a6a8d8a65d03b4b8c1013310c09334c83fba Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Fri, 17 Jan 2025 09:21:49 +0100 Subject: [PATCH 2/4] Add `any_values` and `extra_values` snippets for rust (#8718) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the new `SerializedComponentBatch` acting as the core logging type in Rust, we can now emulate Python's `AnyValue`s with little efforts. ```rust fn main() -> Result<(), Box> { let rec = rerun::RecordingStreamBuilder::new("rerun_example_any_values").spawn()?; let confidences = rerun::SerializedComponentBatch::new( Arc::new(arrow::array::Float64Array::from(vec![1.2, 3.4, 5.6])), rerun::ComponentDescriptor::new("confidence"), ); let description = rerun::SerializedComponentBatch::new( Arc::new(arrow::array::StringArray::from(vec!["Bla bla bla…"])), rerun::ComponentDescriptor::new("description"), ); rec.log("any_values", &[confidences, description])?; Ok(()) } ``` --- docs/snippets/INDEX.md | 12 +++++------ docs/snippets/all/tutorials/any_values.rs | 23 +++++++++++++++++++++ docs/snippets/all/tutorials/extra_values.py | 2 +- docs/snippets/all/tutorials/extra_values.rs | 22 ++++++++++++++++++++ docs/snippets/snippets.toml | 5 +++-- lychee.toml | 10 +++++---- 6 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 docs/snippets/all/tutorials/any_values.rs create mode 100644 docs/snippets/all/tutorials/extra_values.rs diff --git a/docs/snippets/INDEX.md b/docs/snippets/INDEX.md index abd75b46af08..ff1d6402e89d 100644 --- a/docs/snippets/INDEX.md +++ b/docs/snippets/INDEX.md @@ -24,9 +24,9 @@ Use it to quickly find copy-pastable snippets of code for any Rerun feature you' | ------- | ------- | ----------- | ------ | ---- | --- | | **Dataframes** | `dataframe_query` | Query and display the first 10 rows of a recording | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_query.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_query.rs) | | | **Dataframes** | `dataframe_view_query` | Query and display the first 10 rows of a recording in a dataframe view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/reference/dataframe_view_query.py) | | | -| **`AnyValue`** | `any_values` | Log arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/any_values.py) | | | +| **`AnyValue`** | `any_values` | Log arbitrary data | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/any_values.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/any_values.rs) | | | **`AnyValue`** | `any_values_send_columns` | Use `AnyValues` and `send_column` to send entire columns of custom data to Rerun | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/howto/any_values_send_columns.py) | | | -| **`AnyValue`** | `extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **`AnyValue`** | `extra_values` | Log extra values with a `Points2D` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.rs) | | @@ -124,7 +124,7 @@ _All snippets, organized by the [`Archetype`](https://rerun.io/docs/reference/ty | **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | | **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | | **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | -| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `tutorials/extra_values` | Log extra values with a `Points2D` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.rs) | | | **[`Points2D`](https://rerun.io/docs/reference/types/archetypes/points2d)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_ui_radius.cpp) | | **[`Points3D`](https://rerun.io/docs/reference/types/archetypes/points3d)** | `archetypes/points3d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_simple.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_simple.cpp) | @@ -307,7 +307,7 @@ _All snippets, organized by the [`View`](https://rerun.io/docs/reference/types/v | **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-component-override` | Override a component | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-component-override.py) | | | | **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | | **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `concepts/viscomp-visualizer-override-multiple` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override-multiple.py) | | | -| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `tutorials/extra_values` | Log extra values with a `Points2D` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.rs) | | | **[`Spatial2DView`](https://rerun.io/docs/reference/types/views/spatial2d_view)** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | | **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `archetypes/transform3d_hierarchy` | Logs a transforms transform hierarchy | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_hierarchy.cpp) | | **[`Spatial3DView`](https://rerun.io/docs/reference/types/views/spatial3d_view)** | `views/spatial3d` | Use a blueprint to customize a Spatial3DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial3d.py) | | | @@ -343,7 +343,7 @@ _All snippets, organized by the blueprint-related [`Archetype`](https://rerun.io | **`VisualBounds2D`** | `archetypes/points2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.cpp) | | **`VisualBounds2D`** | `archetypes/points2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.cpp) | | **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a `Points2D` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.rs) | | | **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/graph.py) | | | | **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | @@ -367,7 +367,7 @@ _All snippets, organized by the blueprint-related [`Component`](https://rerun.io | **`VisualBounds2D`** | `archetypes/points2d_simple` | Log some very simple points | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_simple.cpp) | | **`VisualBounds2D`** | `archetypes/points2d_ui_radius` | Log some points with ui points & scene unit radii | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points2d_ui_radius.cpp) | | **`VisualBounds2D`** | `concepts/different_data_per_timeline` | Log different data on different timelines | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.rs) | [🌊](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/different_data_per_timeline.cpp) | -| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a Points2D | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | | | +| **`VisualBounds2D`** | `tutorials/extra_values` | Log extra values with a `Points2D` | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.py) | [πŸ¦€](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.rs) | | | **`VisualBounds2D`** | `views/graph` | Use a blueprint to customize a graph view | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/graph.py) | | | | **`VisualBounds2D`** | `views/spatial2d` | Use a blueprint to customize a Spatial2DView | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/views/spatial2d.py) | | | | **`VisualizerOverrides`** | `concepts/viscomp-visualizer-override` | Override a visualizer | [🐍](https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/concepts/viscomp-visualizer-override.py) | | | diff --git a/docs/snippets/all/tutorials/any_values.rs b/docs/snippets/all/tutorials/any_values.rs new file mode 100644 index 000000000000..198484d16fa8 --- /dev/null +++ b/docs/snippets/all/tutorials/any_values.rs @@ -0,0 +1,23 @@ +//! Log arbitrary data. + +use std::sync::Arc; + +use rerun::external::arrow; + +fn main() -> Result<(), Box> { + let rec = rerun::RecordingStreamBuilder::new("rerun_example_any_values").spawn()?; + + let confidences = rerun::SerializedComponentBatch::new( + Arc::new(arrow::array::Float64Array::from(vec![1.2, 3.4, 5.6])), + rerun::ComponentDescriptor::new("confidence"), + ); + + let description = rerun::SerializedComponentBatch::new( + Arc::new(arrow::array::StringArray::from(vec!["Bla bla bla…"])), + rerun::ComponentDescriptor::new("description"), + ); + + rec.log("any_values", &[confidences, description])?; + + Ok(()) +} diff --git a/docs/snippets/all/tutorials/extra_values.py b/docs/snippets/all/tutorials/extra_values.py index d8d65fea4af4..9c4809e31f03 100644 --- a/docs/snippets/all/tutorials/extra_values.py +++ b/docs/snippets/all/tutorials/extra_values.py @@ -1,4 +1,4 @@ -"""Log extra values with a Points2D.""" +"""Log extra values with a `Points2D`.""" import rerun as rr import rerun.blueprint as rrb diff --git a/docs/snippets/all/tutorials/extra_values.rs b/docs/snippets/all/tutorials/extra_values.rs new file mode 100644 index 000000000000..cda43cf26fd6 --- /dev/null +++ b/docs/snippets/all/tutorials/extra_values.rs @@ -0,0 +1,22 @@ +//! Log extra values with a `Points2D`. + +use std::sync::Arc; + +use rerun::external::arrow; + +fn main() -> Result<(), Box> { + let rec = rerun::RecordingStreamBuilder::new("rerun_example_extra_values").spawn()?; + + let points = rerun::Points2D::new([(-1.0, -1.0), (-1.0, 1.0), (1.0, -1.0), (1.0, 1.0)]); + let confidences = rerun::SerializedComponentBatch::new( + Arc::new(arrow::array::Float64Array::from(vec![0.3, 0.4, 0.5, 0.6])), + rerun::ComponentDescriptor::new("confidence"), + ); + + rec.log( + "extra_values", + &[&points as &dyn rerun::AsComponents, &confidences], + )?; + + Ok(()) +} diff --git a/docs/snippets/snippets.toml b/docs/snippets/snippets.toml index 3001e5c1b9dc..429c138395f6 100644 --- a/docs/snippets/snippets.toml +++ b/docs/snippets/snippets.toml @@ -134,7 +134,6 @@ ] "tutorials/any_values" = [ # Not yet implemented "cpp", - "rust", ] "tutorials/custom-application-id" = [ # Not a complete examples "cpp", @@ -151,7 +150,9 @@ "rust", "py", ] -"tutorials/extra_values" = ["cpp", "rust"] # Missing examples +"tutorials/extra_values" = [ # Missing examples + "cpp", +] "tutorials/log-file" = [ # Not a complete examples "cpp", "rust", diff --git a/lychee.toml b/lychee.toml index dbe1ae32f097..26cd9309d017 100644 --- a/lychee.toml +++ b/lychee.toml @@ -154,13 +154,15 @@ exclude = [ # '^file:///', # Ignore local file links. They need to be tested, but it's useful for external links we have to ping. # Snippets that haven't been released yet. - 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates.py', - 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.py', 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates.cpp', - 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.cpp', + 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates.py', 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates.rs', + 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.cpp', + 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.py', 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/points3d_partial_updates_legacy.rs', - 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_partial_updates.py', 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_partial_updates.cpp', + 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_partial_updates.py', 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/archetypes/transform3d_partial_updates.rs', + 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/any_values.rs', + 'https://github.com/rerun-io/rerun/blob/main/docs/snippets/all/tutorials/extra_values.rs', ] From fb14c334dd2236acd85823c816f4e9e8466aaf73 Mon Sep 17 00:00:00 2001 From: Olivier Le Doeuff Date: Fri, 17 Jan 2025 11:23:46 +0100 Subject: [PATCH 3/4] doc: Update `annotation-context.rs` to use correct API (#8708) Co-authored-by: Antoine Beyeler Co-authored-by: Clement Rey --- docs/content/concepts/annotation-context.md | 2 +- .../all/tutorials/annotation-context.rs | 56 ------------------- .../all/tutorials/annotation_context.cpp | 38 +++++++++++++ ...ation-context.py => annotation_context.py} | 4 +- .../all/tutorials/annotation_context.rs | 40 +++++++++++++ docs/snippets/snippets.toml | 5 -- 6 files changed, 82 insertions(+), 63 deletions(-) delete mode 100644 docs/snippets/all/tutorials/annotation-context.rs create mode 100644 docs/snippets/all/tutorials/annotation_context.cpp rename docs/snippets/all/tutorials/{annotation-context.py => annotation_context.py} (89%) create mode 100644 docs/snippets/all/tutorials/annotation_context.rs diff --git a/docs/content/concepts/annotation-context.md b/docs/content/concepts/annotation-context.md index cd89d4cee311..a70f22d224d3 100644 --- a/docs/content/concepts/annotation-context.md +++ b/docs/content/concepts/annotation-context.md @@ -56,7 +56,7 @@ Annotation contexts are logged with: * Python: 🐍[`rr.AnnotationContext`](https://ref.rerun.io/docs/python/stable/common/archetypes/#rerun.archetypes.AnnotationContext) * Rust: πŸ¦€[`rerun::AnnotationContext`](https://docs.rs/rerun/latest/rerun/archetypes/struct.AnnotationContext.html#) -snippet: tutorials/annotation-context +snippet: tutorials/annotation_context ## Affected entities diff --git a/docs/snippets/all/tutorials/annotation-context.rs b/docs/snippets/all/tutorials/annotation-context.rs deleted file mode 100644 index fa5bab0a4c96..000000000000 --- a/docs/snippets/all/tutorials/annotation-context.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Annotation context with two classes, using two labeled classes, of which ones defines a color. -MsgSender::new("masks") // Applies to all entities below "masks". - .with_static(true) - .with_component(&[AnnotationContext { - class_map: [ - ClassDescription { - info: AnnotationInfo { - id: 0, - label: Some(Label("Background".into())), - color: None, - }, - ..Default::default() - }, - ClassDescription { - info: AnnotationInfo { - id: 0, - label: Some(Label("Person".into())), - color: Some(Color(0xFF000000)), - }, - ..Default::default() - }, - ] - .into_iter() - .map(|class| (ClassId(class.info.id), class)) - .collect(), - }])? - .send(rec)?; - -// Annotation context with simple keypoints & keypoint connections. -MsgSender::new("detections") // Applies to all entities below "detections". - .with_static(true) - .with_component(&[AnnotationContext { - class_map: std::iter::once(( - ClassId(0), - ClassDescription { - info: AnnotationInfo { - id: 0, - label: Some(Label("Snake".into())), - color: None, - }, - keypoint_map: (0..10) - .map(|i| AnnotationInfo { - id: i, - label: None, - color: Some(Color::from_rgb(0, (255 / 9 * i) as u8, 0)), - }) - .map(|keypoint| (KeypointId(keypoint.id), keypoint)) - .collect(), - keypoint_connections: (0..9) - .map(|i| (KeypointId(i), KeypointId(i + 1))) - .collect(), - }, - )) - .collect(), - }])? - .send(rec)?; diff --git a/docs/snippets/all/tutorials/annotation_context.cpp b/docs/snippets/all/tutorials/annotation_context.cpp new file mode 100644 index 000000000000..d4dde5c3f0ba --- /dev/null +++ b/docs/snippets/all/tutorials/annotation_context.cpp @@ -0,0 +1,38 @@ +#include + +int main() { + const auto rec = rerun::RecordingStream("rerun_example_annotation_context_connections"); + rec.spawn().exit_on_failure(); + + // Annotation context with two classes, using two labeled classes, of which ones defines a + // color. + rec.log_static( + "masks", + rerun::AnnotationContext({ + rerun::AnnotationInfo(0, "Background"), + rerun::AnnotationInfo(1, "Person", rerun::Rgba32(255, 0, 0)), + }) + ); + + // Annotation context with simple keypoints & keypoint connections. + std::vector keypoint_annotations; + for (uint16_t i = 0; i < 10; ++i) { + keypoint_annotations.push_back( + rerun::AnnotationInfo(i, rerun::Rgba32(0, static_cast(28 * i), 0)) + ); + } + + std::vector keypoint_connections; + for (uint16_t i = 0; i < 9; ++i) { + keypoint_connections.push_back(rerun::KeypointPair(i, i + 1)); + } + + rec.log_static( + "detections", // Applies to all entities below "detections". + rerun::AnnotationContext({rerun::ClassDescription( + rerun::AnnotationInfo(0, "Snake"), + keypoint_annotations, + keypoint_connections + )}) + ); +} diff --git a/docs/snippets/all/tutorials/annotation-context.py b/docs/snippets/all/tutorials/annotation_context.py similarity index 89% rename from docs/snippets/all/tutorials/annotation-context.py rename to docs/snippets/all/tutorials/annotation_context.py index 4931b28db951..62c4d6d94472 100644 --- a/docs/snippets/all/tutorials/annotation-context.py +++ b/docs/snippets/all/tutorials/annotation_context.py @@ -1,5 +1,7 @@ import rerun as rr +rr.init("rerun_example_annotation_context_connections") + # Annotation context with two classes, using two labeled classes, of which ones defines a color. rr.log( "masks", # Applies to all entities below "masks". @@ -17,7 +19,7 @@ "detections", # Applies to all entities below "detections". rr.ClassDescription( info=rr.AnnotationInfo(0, label="Snake"), - keypoint_annotations=[rr.AnnotationInfo(id=i, color=(0, 255 / 9 * i, 0)) for i in range(10)], + keypoint_annotations=[rr.AnnotationInfo(id=i, color=(0, 28 * i, 0)) for i in range(10)], keypoint_connections=[(i, i + 1) for i in range(9)], ), static=True, diff --git a/docs/snippets/all/tutorials/annotation_context.rs b/docs/snippets/all/tutorials/annotation_context.rs new file mode 100644 index 000000000000..9c105d574749 --- /dev/null +++ b/docs/snippets/all/tutorials/annotation_context.rs @@ -0,0 +1,40 @@ +use rerun::{ + datatypes::{ClassDescriptionMapElem, KeypointId}, + AnnotationContext, AnnotationInfo, ClassDescription, Rgba32, +}; + +fn main() -> Result<(), Box> { + let rec = rerun::RecordingStreamBuilder::new("rerun_example_annotation_context_connections") + .spawn()?; + + // Annotation context with two classes, using two labeled classes, of which ones defines a + // color. + rec.log_static( + "masks", // Applies to all entities below "masks". + &AnnotationContext::new([ + ClassDescriptionMapElem::from((0, "Background")), + ClassDescriptionMapElem::from((1, "Person", Rgba32::from_rgb(255, 0, 0))), + ]), + )?; + + // Annotation context with simple keypoints & keypoint connections. + rec.log_static( + "detections", // Applies to all entities below "detections". + &AnnotationContext::new([ClassDescription { + info: (0, "Snake").into(), + keypoint_annotations: (0..10) + .map(|i| AnnotationInfo { + id: i, + label: None, + color: Some(Rgba32::from_rgb(0, (28 * i) as u8, 0)), + }) + .collect(), + keypoint_connections: (0..9) + .map(|i| (KeypointId(i), KeypointId(i + 1))) + .map(Into::into) + .collect(), + }]), + )?; + + Ok(()) +} diff --git a/docs/snippets/snippets.toml b/docs/snippets/snippets.toml index 429c138395f6..98df865bfb43 100644 --- a/docs/snippets/snippets.toml +++ b/docs/snippets/snippets.toml @@ -127,11 +127,6 @@ "rust", "py", ] -"tutorials/annotation-context" = [ # Not a complete example - "cpp", - "rust", - "py", -] "tutorials/any_values" = [ # Not yet implemented "cpp", ] From 4db780c76e0d9990cb7118b20f3e4ac68f96aa33 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Fri, 17 Jan 2025 11:30:31 +0100 Subject: [PATCH 4/4] Pin ci machines with Vulkan setup to Ubuntu 22.04 (#8721) `ubuntu-latest` got updated to imply Ubuntu 24. This makes our software rasterizer script fail with ``` ERROR: [Loader Message] Code 0 : libLLVM-15.so.1: cannot open shared object file: No such file or directory ERROR: libLLVM-15.so.1: cannot open shared object file: No such file or directory ``` when running vulkaninfo. Surely we can fix this by installing the necessary dependencies, but for now let's just pin this to the previous OS version. --- .github/workflows/contrib_checks.yml | 6 ++++-- .github/workflows/reusable_checks_rust.yml | 3 ++- crates/utils/re_video/src/decode/mod.rs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/contrib_checks.yml b/.github/workflows/contrib_checks.yml index 44f68ed6d9ab..ddaad0e4dc06 100644 --- a/.github/workflows/contrib_checks.yml +++ b/.github/workflows/contrib_checks.yml @@ -76,7 +76,8 @@ jobs: no-codegen-changes: name: Check if running codegen would produce any changes - runs-on: ubuntu-latest-16-cores + # TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so + runs-on: ubuntu-22.04-large steps: # Note: We explicitly don't override `ref` here. We need to see if changes would be made # in a context where we have merged with main. Otherwise we might miss changes such as one @@ -92,7 +93,8 @@ jobs: rs-lints: name: Rust lints (fmt, check, clippy, tests, doc) - runs-on: ubuntu-latest-16-cores + # TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so + runs-on: ubuntu-22.04-16core steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/reusable_checks_rust.yml b/.github/workflows/reusable_checks_rust.yml index 5d42487f45b3..3140ac967af1 100644 --- a/.github/workflows/reusable_checks_rust.yml +++ b/.github/workflows/reusable_checks_rust.yml @@ -52,7 +52,8 @@ jobs: rs-lints: name: Rust lints (fmt, check, clippy, tests, doc) - runs-on: ubuntu-latest-16-cores + # TODO(andreas): setup-vulkan doesn't work on 24.4 right now due to missing .so + runs-on: ubuntu-22.04-large steps: - uses: actions/checkout@v4 with: diff --git a/crates/utils/re_video/src/decode/mod.rs b/crates/utils/re_video/src/decode/mod.rs index b8f4f3db1322..52e092b71d3a 100644 --- a/crates/utils/re_video/src/decode/mod.rs +++ b/crates/utils/re_video/src/decode/mod.rs @@ -337,7 +337,7 @@ pub enum PixelFormat { Yuv { layout: YuvPixelLayout, range: YuvRange, - // TODO(andreas): color primaries should also apply to RGB data, + // TODO(andreas): Color primaries should also apply to RGB data, // but for now we just always assume RGB to be BT.709 ~= sRGB. coefficients: YuvMatrixCoefficients, // Note that we don't handle chroma sample location at all so far.