Refactor codebase to improve performance, maintainability and usability#68
Merged
flferretti merged 24 commits intomainfrom Mar 27, 2026
Merged
Refactor codebase to improve performance, maintainability and usability#68flferretti merged 24 commits intomainfrom
flferretti merged 24 commits intomainfrom
Conversation
1729d04 to
e9dae82
Compare
09c4db3 to
9a50870
Compare
5cb9e28 to
d43b8f4
Compare
- Add LRU cache for repeated SDF content processing to avoid redundant subprocess calls - Optimize temporary file handling by writing directly to /tmp on Unix systems - Add environment isolation (IGN_PARTITION/GZ_PARTITION) to prevent interference - Implement batch processing support for multiple descriptions - Add cache management with clear_cache() method - Improve string parsing with early exit for SDF tag detection - Use optimized subprocess bufsize for better I/O performance
d43b8f4 to
d76de30
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors key parts of ROD to improve performance and maintainability, notably optimizing Gazebo sdformat processing via caching and simplifying several internal transformation/export pipelines. It also modernizes packaging by switching to hatchling/hatch-vcs and improves the CLI’s UX and version reporting.
Changes:
- Added cached processing + batch helpers for Gazebo
sdformatmodel description processing. - Refactored frame convention switching and kinematics transform computation for simpler flow and caching.
- Modernized packaging/build (move to
hatchling, add console script), and improved CLI/help text and version handling.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/rod/utils/gazebo.py | Adds cached sdformat processing and a batch API; changes temp-file strategy for speed. |
| src/rod/utils/frame_convention.py | Refactors frame-convention switching into helper functions and uses updated TreeTransforms API. |
| src/rod/urdf/exporter.py | Restructures URDF export code into smaller helpers, adds type aliases, and updates logging usage. |
| src/rod/sdf/common.py | Moves imports to module scope for efficiency/clarity in pose transform computation. |
| src/rod/kinematics/tree_transforms.py | Reworks transform computation to cache paths and adds cache management helpers. |
| src/rod/kinematics/kinematic_tree.py | Refactors kinematic tree building into smaller helpers and changes indexing logic. |
| src/rod/main.py | Improves CLI help text, adds robust version lookup, and ensures consistent exit behavior. |
| src/rod/init.py | Exposes package version via rod._version when available. |
| setup.py | Removes legacy setuptools entrypoint. |
| pyproject.toml | Switches build backend to hatchling, adds console script entry, configures VCS version file. |
| pixi.lock | Updates dependency lockfile. |
| environment.yml | Adds dev/test and packaging tools; reorganizes dependency comments. |
| README.md | Fixes spelling (“definitely”). |
| .gitignore | Ignores hatch-generated _version.py and VS Code settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR enhances the codebase by fixing typos, refactoring classes, and optimizing Gazebo SDF processing with caching and batch support. Moreover, it updates the build system to use
hatchlingand improves the command-line interface.First loading run:
Successive loading run:
Switching model frame convention to URDF:
Exporting to URDF:
Test Script