refactor(viewer): refactoring internal logics#264
Merged
Conversation
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Contributor
There was a problem hiding this comment.
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.logacross 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.
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This pull request refactors the rendering logic in the
t4_devkitpackage 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:
render_pointcloud,render_image, and_render_ego_without_schemaby first creating the entity and entity path, then logging them withrr.log, improving code readability and consistency. [1] [2] [3]Lidar segmentation handling improvements:
_sample_data_to_lidarseg_filenameto always be a dictionary (neverNone), and updated_has_lidarsegto check for non-empty content instead ofNone, making segmentation checks more robust._find_lidarseg_filefor safer lookup of lidarseg filenames by sample data token. Updated_render_single_lidarto use this method, avoiding direct dictionary access and improving error handling. [1] [2]Type safety and error messaging:
render_pointcloudfor segmentation mode by including a descriptive error message if the type is incorrect, aiding debugging.