Skip to content

refactor(viewer): refactoring internal logics#264

Merged
ktro2828 merged 5 commits into
mainfrom
refactor/viewer
Feb 10, 2026
Merged

refactor(viewer): refactoring internal logics#264
ktro2828 merged 5 commits into
mainfrom
refactor/viewer

Conversation

@ktro2828
Copy link
Copy Markdown
Collaborator

@ktro2828 ktro2828 commented Feb 9, 2026

What

This pull request refactors the rendering logic in the t4_devkit package to improve code clarity, consistency, and robustness. The main focus is on simplifying how entities are constructed and logged, as well as making lidar segmentation handling more reliable.

Rendering logic refactoring:

  • Unified the construction and logging of entities in render_pointcloud, render_image, and _render_ego_without_schema by first creating the entity and entity path, then logging them with rr.log, improving code readability and consistency. [1] [2] [3]

Lidar segmentation handling improvements:

  • Changed _sample_data_to_lidarseg_filename to always be a dictionary (never None), and updated _has_lidarseg to check for non-empty content instead of None, making segmentation checks more robust.
  • Added a new helper method _find_lidarseg_file for safer lookup of lidarseg filenames by sample data token. Updated _render_single_lidar to use this method, avoiding direct dictionary access and improving error handling. [1] [2]

Type safety and error messaging:

  • Improved type assertion in render_pointcloud for segmentation mode by including a descriptive error message if the type is incorrect, aiding debugging.

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 February 9, 2026 21:12
@github-actions github-actions Bot added the refactor Refactoring code or increasing performance label Feb 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors viewer rendering and lidar segmentation handling to make entity logging more consistent and segmentation lookup safer.

Changes:

  • Unified entity path/entity construction before rr.log across pointcloud and image rendering.
  • Made lidarseg filename mapping always a dict and added a helper for safe lidarseg lookup.
  • Improved the segmentation-mode type assertion error message in render_pointcloud.

Reviewed changes

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

File Description
t4_devkit/viewer/viewer.py Reworks rendering functions to construct entity_path + entity then log once; improves assertion messaging for segmentation pointclouds.
t4_devkit/helper/rendering.py Makes lidarseg mapping non-optional and introduces safe lookup helper used by lidar rendering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread t4_devkit/viewer/viewer.py Outdated
Comment thread t4_devkit/helper/rendering.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 9, 2026

☂️ Python Coverage

current status: ❌

Overall Coverage

Lines Covered Coverage Threshold Status
4207 3483 83% 50% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
t4_devkit/helper/rendering.py 18% 🔴
t4_devkit/viewer/viewer.py 87% 🟢
TOTAL 53% 🔴

updated for commit: f4a74ea by action🐍

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
@ktro2828 ktro2828 self-assigned this Feb 9, 2026
@ktro2828 ktro2828 merged commit b4f9060 into main Feb 10, 2026
5 checks passed
@ktro2828 ktro2828 deleted the refactor/viewer branch February 10, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring code or increasing performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants