Skip to content

fix: resolve input types of viewer#187

Merged
ktro2828 merged 3 commits into
mainfrom
fix/viewer/record-type
Sep 1, 2025
Merged

fix: resolve input types of viewer#187
ktro2828 merged 3 commits into
mainfrom
fix/viewer/record-type

Conversation

@ktro2828

@ktro2828 ktro2828 commented Sep 1, 2025

Copy link
Copy Markdown
Collaborator

What

This pull request introduces several improvements to the documentation and codebase for the T4 DevKit viewer, focusing on clearer installation instructions and enhanced type safety for rendering and record classes. The most significant changes are grouped below.

Documentation improvements:

  • Clarified installation instructions in README.md and docs/install.md by distinguishing steps for users ("Install via GitHub") and developers ("Install from source"). [1] [2] [3] [4]
  • Expanded docs/tutorials/render.md with detailed usage examples for rendering 2D/3D boxes, point clouds, lanelet maps, and images, including new code snippets and visual output.

Type safety and code consistency:

  • Updated type annotations in t4_devkit/viewer/viewer.py for rendering functions to accept more generic types (Vector3Like, RotationLike, RoiLike) instead of concrete types, improving flexibility and consistency. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Added a helper function _to_rerun_quaternion to standardize quaternion conversion for rendering transformations.

Record class validation:

  • Enhanced the Record classes in t4_devkit/viewer/record/box.py with validators for fields such as rotation, class_id, uuid, and future, ensuring type correctness and reducing runtime errors. [1] [2]
  • Ensured quaternion conversion in _append_with_elements for 3D box records, supporting more flexible input types.

Imports and type hints:

  • Updated imports and type hints in both t4_devkit/viewer/record/box.py and t4_devkit/viewer/viewer.py for consistency and to support the new generic types. [1] [2] [3]

These changes collectively improve user and developer experience, enforce better type safety, and provide richer documentation for rendering capabilities.

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Copilot AI review requested due to automatic review settings September 1, 2025 19:51
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation labels Sep 1, 2025
@github-actions

github-actions Bot commented Sep 1, 2025

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2645 2003 76% 50% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
t4_devkit/viewer/record/box.py 93% 🟢
t4_devkit/viewer/viewer.py 84% 🟢
TOTAL 88% 🟢

updated for commit: 856629b by action🐍

1 similar comment
@github-actions

github-actions Bot commented Sep 1, 2025

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2645 2003 76% 50% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
t4_devkit/viewer/record/box.py 93% 🟢
t4_devkit/viewer/viewer.py 84% 🟢
TOTAL 88% 🟢

updated for commit: 856629b by action🐍

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances type safety and flexibility for the T4 DevKit viewer by updating input types to accept more generic type hints, improving quaternion handling, and adding comprehensive documentation with examples.

  • Updated viewer method signatures to accept Vector3Like, RotationLike, and RoiLike types instead of concrete types
  • Added quaternion conversion helper function and validators for record classes
  • Enhanced documentation with detailed rendering examples and clearer installation instructions

Reviewed Changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
t4_devkit/viewer/viewer.py Updated type hints to generic types, added quaternion conversion helper function
t4_devkit/viewer/record/box.py Added field validators and quaternion conversion for improved type safety
docs/tutorials/render.md Expanded with detailed usage examples and visual outputs for rendering functionality
docs/install.md Clarified installation instructions for users vs developers
README.md Updated installation section headers to distinguish user vs developer instructions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

import rerun.blueprint as rrb
from typing_extensions import Self

from t4_devkit.common.converter import to_quaternion

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The import of to_quaternion is added but the corresponding removal of unused imports (Quaternion, Roi, Vector3) is missing from line 15. These concrete types should be removed since they're replaced with generic *Like types.

Copilot uses AI. Check for mistakes.
import rerun as rr
import rerun.components as rrc
from attrs import converters, define, field
from attrs import converters, define, field, validators

Copilot AI Sep 1, 2025

Copy link

Choose a reason for hiding this comment

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

The import statement is missing the removal of unused imports. Since concrete types are replaced with generic types, imports like Roi and Vector3 from line 12 may no longer be needed if they're only used for type annotations that are now using *Like types.

Copilot uses AI. Check for mistakes.
@ktro2828 ktro2828 merged commit e6f1244 into main Sep 1, 2025
4 of 5 checks passed
@ktro2828 ktro2828 deleted the fix/viewer/record-type branch September 1, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants