Skip to content
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

Feature/urdf to mjcf #309

Merged
merged 8 commits into from
Aug 22, 2024
Merged

Feature/urdf to mjcf #309

merged 8 commits into from
Aug 22, 2024

Conversation

nathanjzhao
Copy link
Contributor

What does this PR do?

This should be a short, one-line description.

What issues does this PR fix or reference?

If relevant, please include a reference to the issue here.

If this PR changes the UI, include a screenshot below.

Otherwise, feel free to delete this section.

@nathanjzhao nathanjzhao requested a review from codekansas August 21, 2024 19:27
Copy link
Member

@codekansas codekansas left a comment

Choose a reason for hiding this comment

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

nice nice, some requests, i will take a look at this later and merge

store/app/crud/urdf.py Outdated Show resolved Hide resolved
if mesh_names:
raise BadArtifactError(f"Mesh files uploaded were not referenced: {mesh_names}")

logger.info("refs", mesh_references)
Copy link
Member

Choose a reason for hiding this comment

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

can remove this i think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we dont want redundancy tho

@@ -89,10 +89,11 @@ async def set_urdf(

# Gets the compression type from the file content type and filename.
compression_type = get_compression_type(file.content_type, file.filename)
if compression_type not in ("tgz", "zip"):

if compression_type not in ("tgz", "zip", "tar.gz"):
Copy link
Member

Choose a reason for hiding this comment

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

compression_type is a python string literal, tar.gz shouldn't be an option (it gets mapped to tgz compression type)

from store.app.utils.formats import mjcf


def contains_urdf_or_mjcf(folder_path: Path) -> str:
Copy link
Member

Choose a reason for hiding this comment

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

this is gonna seem even more neurotic but you can do this instead. the reason is that the type checker will then be able to detect string typos

Suggested change
def contains_urdf_or_mjcf(folder_path: Path) -> str:
from typing import MeshType
MeshType = Literal["urdf", "mjcf"]
def contains_urdf_or_mjcf(folder_path: Path) -> MeshType:

Comment on lines +479 to +481
# HACK
# mujoco has a hard time reading meshes
_copy_stl_files(self.output_dir / "meshes", self.output_dir)
Copy link
Member

Choose a reason for hiding this comment

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

we should probably do this correctly

@codekansas codekansas merged commit 78a3036 into master Aug 22, 2024
1 check passed
@codekansas codekansas deleted the feature/urdf-to-mjcf branch August 22, 2024 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants