Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Aug 22, 2024
1 parent 3f5de9f commit e49a11c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions kscale/formats/mjcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
joint.set("frictionloss", str(self.frictionloss))
return joint


@dataclass
class Inertial:
mass: float | None = None
Expand All @@ -108,6 +109,7 @@ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
inertial.set("inertia", " ".join(map(str, self.inertia)))
return inertial


@dataclass
class Geom:
name: str | None = None
Expand Down Expand Up @@ -160,6 +162,7 @@ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
geom.set("density", str(self.density))
return geom


@dataclass
class Body:
name: str
Expand All @@ -184,6 +187,7 @@ def to_xml(self, root: ET.Element | None = None) -> ET.Element:
self.inertial.to_xml(body) # Add inertial to the XML
return body


@dataclass
class Flag:
frictionloss: str | None = None
Expand Down
4 changes: 3 additions & 1 deletion kscale/store/gen/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,12 @@ class GetBatchListingsResponse(BaseModel):
class HTTPValidationError(BaseModel):
detail: Optional[List[ValidationError]] = Field(None, title="Detail")


class MjcfInfo(BaseModel):
artifact_id: str = Field(..., title="Artifact Id")
url: str = Field(..., title="Url")


class MjcfResponse(BaseModel):
mjcf: Optional[MjcfInfo]
listing_id: str = Field(..., title="Listing Id")
listing_id: str = Field(..., title="Listing Id")
4 changes: 2 additions & 2 deletions kscale/store/mjcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ def get_listing_dir() -> Path:
parser.add_argument("folder_path", help="The path to the folder containing the MJCF files")
parsed_args = parser.parse_args(remaining_args)
folder_path = Path(parsed_args.folder_path).expanduser().resolve()

urdf_or_mjcf = contains_urdf_or_mjcf(folder_path)
if urdf_or_mjcf == 'mjcf':
if urdf_or_mjcf == "mjcf":
output_filename = f"{listing_id}.tgz"
tarball_path = create_tarball(folder_path, output_filename, get_listing_dir())

Expand Down
2 changes: 1 addition & 1 deletion kscale/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ def mjcf_to_urdf(input_mjcf: Path) -> None:
# Save the combined URDF
combined_urdf_editor.saveUrdf(combined_urdf_path)

print(f"Combined URDF saved to: {combined_urdf_path}")
print(f"Combined URDF saved to: {combined_urdf_path}")

0 comments on commit e49a11c

Please sign in to comment.