Import upstream snapshot 80e710700aac9573a2230f74f7ce9e094833a0bc
Upstream: https://github.com/Rhoban/onshape-to-robot Upstream-Commit: 80e710700aac9573a2230f74f7ce9e094833a0bc Upstream-Branch: master
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
import numpy as np
|
||||
|
||||
|
||||
class Geometry:
|
||||
def __init__(
|
||||
self,
|
||||
color: np.ndarray = np.array([0.5, 0.5, 0.5, 1.0]),
|
||||
visual: bool = True,
|
||||
collision: bool = True,
|
||||
):
|
||||
self.color: np.ndarray = color
|
||||
self.visual: bool = visual
|
||||
self.collision: bool = collision
|
||||
self.visual_properties: dict = {}
|
||||
self.collision_properties: dict = {}
|
||||
|
||||
def is_type(self, what: str):
|
||||
if what == "visual":
|
||||
return self.visual
|
||||
elif what == "collision":
|
||||
return self.collision
|
||||
return False
|
||||
|
||||
|
||||
class Mesh(Geometry):
|
||||
def __init__(
|
||||
self,
|
||||
filename: str,
|
||||
color: np.ndarray = np.array([0.5, 0.5, 0.5, 1.0]),
|
||||
visual: bool = True,
|
||||
collision: bool = True,
|
||||
):
|
||||
super().__init__(color, visual, collision)
|
||||
self.filename: str = filename
|
||||
|
||||
|
||||
class Shape(Geometry):
|
||||
def __init__(
|
||||
self,
|
||||
T_part_shape: np.ndarray,
|
||||
color: np.ndarray = np.array([0.5, 0.5, 0.5, 1.0]),
|
||||
visual: bool = True,
|
||||
collision: bool = True,
|
||||
):
|
||||
super().__init__(color, visual, collision)
|
||||
self.T_part_shape: np.ndarray = T_part_shape
|
||||
|
||||
|
||||
class Box(Shape):
|
||||
def __init__(
|
||||
self,
|
||||
T_part_shape: np.ndarray,
|
||||
size: np.ndarray,
|
||||
color: np.ndarray = np.array([0.5, 0.5, 0.5, 1.0]),
|
||||
visual: bool = True,
|
||||
collision: bool = True,
|
||||
):
|
||||
super().__init__(T_part_shape, color, visual, collision)
|
||||
self.size: np.ndarray = size
|
||||
|
||||
|
||||
class Cylinder(Shape):
|
||||
def __init__(
|
||||
self,
|
||||
T_part_shape: np.ndarray,
|
||||
length: float,
|
||||
radius: float,
|
||||
color: np.ndarray = np.array([0.5, 0.5, 0.5, 1.0]),
|
||||
visual: bool = True,
|
||||
collision: bool = True,
|
||||
):
|
||||
super().__init__(T_part_shape, color, visual, collision)
|
||||
self.length: float = length
|
||||
self.radius: float = radius
|
||||
|
||||
|
||||
class Sphere(Shape):
|
||||
def __init__(
|
||||
self,
|
||||
T_part_shape: np.ndarray,
|
||||
radius: float,
|
||||
color: np.ndarray = np.array([0.5, 0.5, 0.5, 1.0]),
|
||||
visual: bool = True,
|
||||
collision: bool = True,
|
||||
):
|
||||
super().__init__(T_part_shape, color, visual, collision)
|
||||
self.radius: float = radius
|
||||
Reference in New Issue
Block a user