-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0106f8
commit abeb4e1
Showing
18 changed files
with
888 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# rod | ||
The ultimate Python tool for RObot Descriptions processing. | ||
# RObot Description processor | ||
|
||
**The ultimate Python tool for RObot Descriptions processing.** |
This file contains 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,20 @@ | ||
[build-system] | ||
requires = [ | ||
"wheel", | ||
"setuptools>=45", | ||
"setuptools_scm[toml]>=6.2", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
local_scheme = "dirty-tag" | ||
|
||
[tool.black] | ||
line-length = 88 | ||
|
||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 3 | ||
|
||
[tool.cibuildwheel] | ||
build-frontend = "build" |
This file contains 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,63 @@ | ||
[metadata] | ||
name = rod | ||
description = The ultimate Python tool for RObot Descriptions processing. | ||
long_description = file: README.md | ||
long_description_content_type = text/markdown | ||
author = Diego Ferigo | ||
author_email = [email protected] | ||
license = MIT | ||
license_files = LICENSE | ||
platforms = any | ||
url = https://github.com/ami-iit/rod | ||
|
||
project_urls = | ||
Changelog = https://github.com/ami-iit/rod/releases | ||
Source = https://github.com/ami-iit/rod | ||
Tracker = https://github.com/ami-iit/rod/issues | ||
|
||
keywords = | ||
description | ||
gazebo | ||
parser | ||
robot | ||
robotics | ||
ros | ||
sdf | ||
sdformat | ||
simulator | ||
simulation | ||
urdf | ||
|
||
classifiers = | ||
Development Status :: 5 - Production/Stable | ||
Framework :: Robot Framework | ||
Intended Audience :: Science/Research | ||
Intended Audience :: Developers | ||
Intended Audience :: Education | ||
License :: OSI Approved :: MIT License | ||
Operating System :: OS Independent | ||
Operating System :: POSIX :: Linux | ||
Operating System :: MacOS | ||
Operating System :: Microsoft :: Windows | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
Programming Language :: Python :: 3.11 | ||
Programming Language :: Python :: 3 :: Only | ||
Programming Language :: Python :: Implementation :: CPython | ||
Topic :: Games/Entertainment :: Simulation | ||
|
||
[options] | ||
zip_safe = False | ||
packages = find: | ||
package_dir = | ||
=src | ||
python_requires = >=3.8 | ||
install_requires = | ||
mashumaro | ||
numpy | ||
xmltodict | ||
|
||
[options.packages.find] | ||
where = src |
This file contains 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,3 @@ | ||
import setuptools | ||
|
||
setuptools.setup() |
This file contains 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,22 @@ | ||
from .collision import Collision | ||
from .common import Pose, Xyz | ||
from .geometry import ( | ||
Box, | ||
Capsule, | ||
Cylinder, | ||
Ellipsoid, | ||
Geometry, | ||
Heightmap, | ||
Mesh, | ||
Plane, | ||
Sphere, | ||
) | ||
from .joint import Axis, Dynamics, Joint, Limit | ||
from .link import Inertia, Inertial, Link | ||
from .material import Material | ||
from .model import Model | ||
from .physics import Physics | ||
from .scene import Scene | ||
from .sdf import Sdf | ||
from .visual import Visual | ||
from .world import World |
This file contains 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,17 @@ | ||
import dataclasses | ||
from typing import Optional | ||
|
||
import mashumaro | ||
|
||
from .common import Pose | ||
from .element import Element | ||
from .geometry import Geometry | ||
|
||
|
||
@dataclasses.dataclass | ||
class Collision(Element): | ||
|
||
geometry: Geometry | ||
name: str = dataclasses.field(metadata=mashumaro.field_options(alias="@name")) | ||
|
||
pose: Optional[Pose] = dataclasses.field(default=None) |
This file contains 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,72 @@ | ||
import dataclasses | ||
from typing import Any, Dict, List, Optional | ||
|
||
import mashumaro | ||
|
||
from .element import Element | ||
|
||
|
||
@dataclasses.dataclass | ||
class Xyz(Element): | ||
|
||
xyz: List[float] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
alias="#text", | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=3), | ||
), | ||
) | ||
|
||
expressed_in: Optional[str] = dataclasses.field( | ||
default=None, metadata=mashumaro.field_options(alias="@expressed_in") | ||
) | ||
|
||
@classmethod | ||
def __pre_deserialize__(cls, d: Dict[Any, Any]) -> Dict[Any, Any]: | ||
|
||
if isinstance(d, str): | ||
d = {"#text": d, "@expressed_in": ""} | ||
|
||
return d | ||
|
||
|
||
@dataclasses.dataclass | ||
class Pose(Element): | ||
|
||
pose: List[float] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
alias="#text", | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=6), | ||
), | ||
) | ||
|
||
relative_to: Optional[str] = dataclasses.field( | ||
default=None, metadata=mashumaro.field_options(alias="@relative_to") | ||
) | ||
|
||
degrees: Optional[bool] = dataclasses.field( | ||
default=None, metadata=mashumaro.field_options(alias="@degrees") | ||
) | ||
|
||
rotation_format: Optional[str] = dataclasses.field( | ||
default=None, metadata=mashumaro.field_options(alias="@rotation_format") | ||
) | ||
|
||
@classmethod | ||
def __pre_deserialize__(cls, d: Dict[Any, Any]) -> Dict[Any, Any]: | ||
|
||
if isinstance(d, str): | ||
d = {"#text": d, "@relative_to": ""} | ||
|
||
return d | ||
|
||
@property | ||
def xyz(self) -> List[float]: | ||
return self.pose[0:3] | ||
|
||
@property | ||
def rpy(self) -> List[float]: | ||
return self.pose[3:6] |
This file contains 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,132 @@ | ||
import dataclasses | ||
from typing import List, Optional | ||
|
||
import mashumaro | ||
|
||
from .element import Element | ||
|
||
|
||
@dataclasses.dataclass | ||
class Box(Element): | ||
|
||
size: List[float] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=3), | ||
), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Capsule(Element): | ||
|
||
radius: float = dataclasses.field( | ||
metadata=mashumaro.field_options(serialize=Element.serialize_float), | ||
) | ||
|
||
length: float = dataclasses.field( | ||
metadata=mashumaro.field_options(serialize=Element.serialize_float), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Cylinder(Element): | ||
|
||
radius: float = dataclasses.field( | ||
metadata=mashumaro.field_options(serialize=Element.serialize_float), | ||
) | ||
|
||
length: float = dataclasses.field( | ||
metadata=mashumaro.field_options(serialize=Element.serialize_float), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Ellipsoid(Element): | ||
|
||
radii: List[float] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=3), | ||
), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Heightmap(Element): | ||
|
||
uri: str | ||
|
||
size: List[float] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
alias="#text", | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=3), | ||
), | ||
) | ||
|
||
pos: List[float] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
alias="#text", | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=3), | ||
), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Mesh(Element): | ||
|
||
uri: str | ||
|
||
scale: Optional[List[float]] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=3), | ||
), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Plane(Element): | ||
|
||
normal: List[float] = dataclasses.field( | ||
metadata=mashumaro.field_options( | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=3), | ||
), | ||
) | ||
|
||
size: Optional[List[float]] = dataclasses.field( | ||
default=None, | ||
metadata=mashumaro.field_options( | ||
serialize=Element.serialize_list, | ||
deserialize=lambda l: Element.deserialize_list(data=l, length=2), | ||
), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Sphere(Element): | ||
|
||
radius: float = dataclasses.field( | ||
metadata=mashumaro.field_options(serialize=Element.serialize_float), | ||
) | ||
|
||
|
||
@dataclasses.dataclass | ||
class Geometry(Element): | ||
|
||
box: Optional[Box] = dataclasses.field(default=None) | ||
capsule: Optional[Capsule] = dataclasses.field(default=None) | ||
cylinder: Optional[Capsule] = dataclasses.field(default=None) | ||
ellipsoid: Optional[Capsule] = dataclasses.field(default=None) | ||
heightmap: Optional[Heightmap] = dataclasses.field(default=None) | ||
mesh: Optional[Mesh] = dataclasses.field(default=None) | ||
plane: Optional[Mesh] = dataclasses.field(default=None) | ||
sphere: Optional[Sphere] = dataclasses.field(default=None) |
Oops, something went wrong.