-
Notifications
You must be signed in to change notification settings - Fork 0
Cut xacro dependency & download URDF assets from ClearML #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3390e54
grasp: added 'urdf_path' param to the robot config
macmacal 7c9643a
grasp: replaced xacro with parametrized URDF path
macmacal 1e875bb
updated changelog
macmacal 1d35648
grasp: removed show_cell Manipulator arg
macmacal 1403542
ADD: script for uploading URDF assets to ClearML
macmacal 06adb2c
grasp: URDF path changed to dataset ID
macmacal 62a795b
updated docs
macmacal 4cd1936
Merge branch 'devel' into feature/cut_xacro_dependency
macmacal 920e87a
fixed script with no parent dataset
macmacal 0c738f4
fmt
macmacal 3d8b6dd
parametrized urdf id for show_cell
macmacal 45a8224
setup urdf models for the geonosis PC
macmacal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #!/usr/bin/env python3 | ||
| """ | ||
| Upload robot simulator assets to ClearML Dataset. | ||
| Handles URDF + STL/DAE models as a versioned dataset. | ||
| """ | ||
|
|
||
| import argparse | ||
| import logging | ||
| from pathlib import Path | ||
| from typing import Optional | ||
|
|
||
| from clearml import Dataset | ||
|
|
||
| logging.basicConfig(level=logging.INFO) | ||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def upload_robot_assets( | ||
| robot_folder_path: str, | ||
| dataset_name: str = "robot_simulator_assets", | ||
| dataset_project: str = "DeepRL", | ||
| parent: str = None, | ||
| output_storage: Optional[str] = None, # None = use default ClearML file server | ||
| description: Optional[str] = None, | ||
| ): | ||
| """ | ||
| Upload robot simulator folder to ClearML Dataset. | ||
|
|
||
| Args: | ||
| robot_folder_path: Path to folder containing URDF + models (STL/DAE) | ||
| dataset_name: Name of the dataset (version auto-incremented) | ||
| dataset_project: Project name in ClearML | ||
| output_storage: Target storage (None=default fileserver, or "/path", "s3://bucket", etc.) | ||
| description: Optional dataset description | ||
| """ | ||
|
|
||
| folder_path = Path(robot_folder_path).resolve() | ||
|
|
||
| if not folder_path.exists(): | ||
| raise FileNotFoundError(f"Folder not found: {robot_folder_path}") | ||
|
|
||
| logger.info(f"📦 Creating dataset: {dataset_project}/{dataset_name}") | ||
| if parent: | ||
| logger.info(f" Parent DatasetID: {parent}") | ||
| logger.info(f" Source folder: {folder_path}") | ||
| logger.info(f" Files to upload: {len(list(folder_path.rglob('*')))}") | ||
|
|
||
| # Create dataset (automatically increments version if exists) | ||
| dataset = Dataset.create( | ||
| dataset_name=dataset_name, | ||
| dataset_project=dataset_project, | ||
| parent_datasets=[parent], | ||
| description=description or "Robot simulator assets", | ||
| ) | ||
|
|
||
| logger.info(f"✓ Dataset created: {dataset.id}") | ||
|
|
||
| # Add all files from folder (preserves structure) | ||
| logger.info("📥 Adding files to dataset...") | ||
| num_files = dataset.add_files(path=str(folder_path), recursive=True, verbose=True) | ||
|
|
||
| logger.info(f"✓ Added {num_files} files") | ||
|
|
||
| # Upload to storage | ||
| logger.info("⬆️ Uploading to ClearML server...") | ||
| dataset.upload( | ||
| show_progress=True, | ||
| output_url=output_storage, # Uses default if None | ||
| ) | ||
|
|
||
| logger.info("✓ Upload complete") | ||
|
|
||
| # Finalize (lock version, prevents further modifications) | ||
| logger.info("🔒 Finalizing dataset...") | ||
| dataset.finalize() | ||
|
|
||
| logger.info("\n✅ SUCCESS!") | ||
| logger.info(f" Dataset ID: {dataset.id}") | ||
| logger.info(f" Project: {dataset_project}") | ||
| logger.info(f" Name: {dataset_name}") | ||
| logger.info(f"\n Use in code: Dataset.get(dataset_id='{dataset.id}')") | ||
|
|
||
| return dataset.id | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| parser = argparse.ArgumentParser(description="Upload robot assets to ClearML") | ||
| parser.add_argument("folder", help="Path to robot model folder") | ||
| parser.add_argument("--name", default="AegisURDFModel", help="Dataset name") | ||
| parser.add_argument("--project", default="AEGIS_GRASP", help="ClearML project") | ||
| parser.add_argument( | ||
| "--parent", | ||
| default=None, | ||
| help="Already existing dataset ID which will be the parent of this version.", | ||
| ) | ||
| parser.add_argument( | ||
| "--storage", default=None, help="Storage URL (s3://, /path, etc.)" | ||
| ) | ||
| parser.add_argument("--desc", default=None, help="Dataset description") | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
| upload_robot_assets( | ||
| robot_folder_path=args.folder, | ||
| dataset_name=args.name, | ||
| dataset_project=args.project, | ||
| parent=args.parent, | ||
| output_storage=args.storage, | ||
| description=args.desc, | ||
| ) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.