Skip to content

Commit

Permalink
Python: remove legacy APIs (#4037)
Browse files Browse the repository at this point in the history
- Fixes #3916 

I've also added `AnnotationInfo` & `ClassDescription` at the root-level
init.
  • Loading branch information
teh-cmc authored Nov 7, 2023
1 parent 3279714 commit 01bbdbc
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 3,187 deletions.
14 changes: 7 additions & 7 deletions docs/content/howto/ros2-nav-turtlebot.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def log_tf_as_transform3d(self, path: str, time: Time) -> None:

As an example of logging points in the map frame, we simply call:
```python
rr.log_points("map/points", positions=pts, colors=colors)
rr.log("map/points", rr.Points3D(positions=pts, colors=colors))
self.log_tf_as_transform3d("map/points", time)
```

Expand All @@ -203,7 +203,7 @@ be logged to the same point on the timeline as the data, using a timestamp looke
matching timepoint.

### Odometry to rr.TimeSeriesScalar and rr.Transform3D
When receiving odometry messages, we log the linear and angular velocities using `rr.log_scalar`.
When receiving odometry messages, we log the linear and angular velocities using `rr.TimeSeriesScalar`.
Additionally, since we know that odometry will also update the `map/robot` transform, we use
this as a cue to look up the corresponding transform and log it.
```python
Expand All @@ -225,7 +225,7 @@ Not all Transforms are rigid as defined in TF. The other transform we want to lo
is the pinhole projection that is stored in the `CameraInfo` msg.

Fortunately, the `image_geometry` package has a `PinholeCameraModel` that exposes
the intrinsic matrix in the same structure used by Rerun `rr.log_pinhole`:
the intrinsic matrix in the same structure used by Rerun `rr.Pinhole`:
```python
def __init__(self) -> None:
#
Expand All @@ -249,7 +249,7 @@ def cam_info_callback(self, info: CameraInfo) -> None:

### Image to rr.Image
ROS Images can also be mapped to Rerun very easily, using the `cv_bridge` package.
The output of `cv_bridge.imgmsg_to_cv2` can be fed directly into `rr.log_image`:
The output of `cv_bridge.imgmsg_to_cv2` can be fed directly into `rr.Image`:
```python
def __init__(self) -> None:
#
Expand All @@ -276,7 +276,7 @@ array of Nx3 floats.
Color is extracted in a similar way, although the realsense gazebo driver does not provide the correct offsets for
the r,g,b channels, requiring us to patch the field values.

After extracting the positions and colors as numpy arrays, the entire cloud can be logged as a batch with `rr.log_points`
After extracting the positions and colors as numpy arrays, the entire cloud can be logged as a batch with `rr.Points3D`
```python
def points_callback(self, points: PointCloud2) -> None:
"""Log a `PointCloud2` with `log_points`."""
Expand Down Expand Up @@ -315,14 +315,14 @@ to do a bit of additional transformation logic (see: [#1534](https://github.com/
First, we convert the scan into a point-cloud using the `laser_geometry` package.
After converting to a point-cloud, we extract the pts just as above with `PointCloud2`.

We could have logged the Points directly using `rr.log_points`, but for
We could have logged the Points directly using `rr.Points3D`, but for
the sake of this demo, we wanted to instead log a laser scan as a bunch of lines
in a similar fashion to how it is depicted in gazebo.

We generate a second matching set of points for each ray projected out 0.3m from
the origin and then interlace the two sets of points using numpy hstack and reshape.
This results in a set of alternating points defining rays from the origin to each
laser scan result, which is the format expected by `rr.log_line_segments`:
laser scan result, which is the format expected by `rr.LineStrips3D`:
```python
def __init__(self) -> None:
#
Expand Down
31 changes: 0 additions & 31 deletions rerun_py/docs/gen_common_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,37 +253,6 @@ class Section:
show_tables=False,
mod_path="rerun.experimental",
),
Section(
title="Deprecated Logging Methods",
func_list=[
"log_annotation_context",
"log_arrow",
"log_cleared",
"log_depth_image",
"log_disconnected_space",
"log_extension_components",
"log_image_file",
"log_image",
"log_line_segments",
"log_line_strip",
"log_mesh_file",
"log_mesh",
"log_meshes",
"log_obb",
"log_pinhole",
"log_point",
"log_points",
"log_rect",
"log_rects",
"log_scalar",
"log_segmentation_image",
"log_tensor",
"log_text_entry",
"log_transform3d",
"log_view_coordinates",
],
show_tables=False,
),
]


Expand Down
58 changes: 2 additions & 56 deletions rerun_py/rerun_sdk/rerun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"MediaType",
"MemoryRecording",
"Mesh3D",
"MeshFormat",
"MeshProperties",
"OutOfTreeTransform3D",
"OutOfTreeTransform3DBatch",
Expand All @@ -46,8 +45,6 @@
"Points3D",
"Quaternion",
"RecordingStream",
"RectFormat",
"Rigid3D",
"RotationAxisAngle",
"Scale3D",
"SegmentationImage",
Expand All @@ -58,8 +55,6 @@
"TextLogLevel",
"TimeSeriesScalar",
"Transform3D",
"Translation3D",
"TranslationAndMat3",
"TranslationAndMat3x3",
"TranslationRotationScale3D",
"ViewCoordinates",
Expand All @@ -78,35 +73,7 @@
"get_thread_local_data_recording",
"is_enabled",
"log",
"log_annotation_context",
"log_arrow",
"log_cleared",
"log_components",
"log_depth_image",
"log_disconnected_space",
"log_extension_components",
"log_image",
"log_image_file",
"log_line_segments",
"log_line_strip",
"log_line_strips_2d",
"log_line_strips_3d",
"log_mesh",
"log_mesh_file",
"log_meshes",
"log_obb",
"log_obbs",
"log_pinhole",
"log_point",
"log_points",
"log_rect",
"log_rects",
"log_scalar",
"log_segmentation_image",
"log_tensor",
"log_text_entry",
"log_transform3d",
"log_view_coordinates",
"memory_recording",
"reset_time",
"save",
Expand Down Expand Up @@ -162,6 +129,8 @@
TextLogLevel,
)
from .datatypes import (
AnnotationInfo,
ClassDescription,
Quaternion,
RotationAxisAngle,
Scale3D,
Expand All @@ -170,29 +139,6 @@
TranslationRotationScale3D,
)
from .error_utils import set_strict_mode
from .log_deprecated.annotation import AnnotationInfo, ClassDescription, log_annotation_context
from .log_deprecated.arrow import log_arrow
from .log_deprecated.bounding_box import log_obb, log_obbs
from .log_deprecated.camera import log_pinhole
from .log_deprecated.clear import log_cleared
from .log_deprecated.extension_components import log_extension_components
from .log_deprecated.file import MeshFormat, log_image_file, log_mesh_file
from .log_deprecated.image import log_depth_image, log_image, log_segmentation_image
from .log_deprecated.lines import log_line_segments, log_line_strip, log_line_strips_2d, log_line_strips_3d
from .log_deprecated.mesh import log_mesh, log_meshes
from .log_deprecated.points import log_point, log_points
from .log_deprecated.rects import RectFormat, log_rect, log_rects
from .log_deprecated.scalar import log_scalar
from .log_deprecated.tensor import log_tensor
from .log_deprecated.text import log_text_entry
from .log_deprecated.transform import (
Rigid3D,
Translation3D,
TranslationAndMat3,
log_disconnected_space,
log_transform3d,
log_view_coordinates,
)
from .logging_handler import LoggingHandler
from .recording import MemoryRecording
from .recording_stream import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""
from __future__ import annotations

from rerun.log_deprecated.experimental.blueprint import add_space_view, new_blueprint, set_auto_space_views, set_panels
from .blueprint import add_space_view, new_blueprint, set_auto_space_views, set_panels

__all__ = [
"add_space_view",
Expand Down
77 changes: 0 additions & 77 deletions rerun_py/rerun_sdk/rerun/log_deprecated/__init__.py

This file was deleted.

73 changes: 0 additions & 73 deletions rerun_py/rerun_sdk/rerun/log_deprecated/annotation.py

This file was deleted.

Loading

0 comments on commit 01bbdbc

Please sign in to comment.