diff --git a/clearpath_config/platform/attachments/dd100.py b/clearpath_config/platform/attachments/dd100.py index fe3505a..cfae4f1 100644 --- a/clearpath_config/platform/attachments/dd100.py +++ b/clearpath_config/platform/attachments/dd100.py @@ -37,17 +37,30 @@ class DD100TopPlate(BaseAttachment): PACS = "pacs" MODELS = [PACS] PARENT = "default_mount" + HEIGHT = 0.1 def __init__( self, name: str = ATTACHMENT_MODEL, model: str = PACS, enabled: bool = BaseAttachment.ENABLED, + height: float = HEIGHT, parent: str = PARENT, xyz: List[float] = Accessory.XYZ, rpy: List[float] = Accessory.RPY ) -> None: super().__init__(name, model, enabled, parent, xyz, rpy) + self.height = height + + def to_dict(self) -> dict: + d = super().to_dict() + d['height'] = self.height + return d + + def from_dict(self, d: dict) -> None: + super().from_dict(d) + if 'height' in d: + self.height = d['height'] # DD100 Attachments diff --git a/clearpath_config/platform/attachments/dd150.py b/clearpath_config/platform/attachments/dd150.py index c49c9b7..6db0e0e 100644 --- a/clearpath_config/platform/attachments/dd150.py +++ b/clearpath_config/platform/attachments/dd150.py @@ -28,26 +28,25 @@ from clearpath_config.common.types.accessory import Accessory from clearpath_config.common.types.platform import Platform from clearpath_config.platform.types.attachment import BaseAttachment, PlatformAttachment +from clearpath_config.platform.attachments.dd100 import DD100TopPlate from typing import List -class DD150TopPlate(BaseAttachment): +class DD150TopPlate(DD100TopPlate): PLATFORM = Platform.DD150 ATTACHMENT_MODEL = "%s.top_plate" % PLATFORM - PACS = "pacs" - MODELS = [PACS] - PARENT = "default_mount" def __init__( self, name: str = ATTACHMENT_MODEL, - model: str = PACS, + model: str = DD100TopPlate.PACS, enabled: bool = BaseAttachment.ENABLED, - parent: str = PARENT, + height: float = DD100TopPlate.HEIGHT, + parent: str = DD100TopPlate.PARENT, xyz: List[float] = Accessory.XYZ, rpy: List[float] = Accessory.RPY ) -> None: - super().__init__(name, model, enabled, parent, xyz, rpy) + super().__init__(name, model, enabled, height, parent, xyz, rpy) # DD150 Attachments diff --git a/clearpath_config/platform/attachments/do100.py b/clearpath_config/platform/attachments/do100.py index 4d19778..37f8293 100644 --- a/clearpath_config/platform/attachments/do100.py +++ b/clearpath_config/platform/attachments/do100.py @@ -28,26 +28,25 @@ from clearpath_config.common.types.accessory import Accessory from clearpath_config.common.types.platform import Platform from clearpath_config.platform.types.attachment import BaseAttachment, PlatformAttachment +from clearpath_config.platform.attachments.dd100 import DD100TopPlate from typing import List -class DO100TopPlate(BaseAttachment): +class DO100TopPlate(DD100TopPlate): PLATFORM = Platform.DO100 ATTACHMENT_MODEL = "%s.top_plate" % PLATFORM - PACS = "pacs" - MODELS = [PACS] - PARENT = "default_mount" def __init__( self, name: str = ATTACHMENT_MODEL, - model: str = PACS, + model: str = DD100TopPlate.PACS, enabled: bool = BaseAttachment.ENABLED, - parent: str = PARENT, + height: float = DD100TopPlate.HEIGHT, + parent: str = DD100TopPlate.PARENT, xyz: List[float] = Accessory.XYZ, rpy: List[float] = Accessory.RPY ) -> None: - super().__init__(name, model, enabled, parent, xyz, rpy) + super().__init__(name, model, enabled, height, parent, xyz, rpy) # DO100 Attachments diff --git a/clearpath_config/platform/attachments/do150.py b/clearpath_config/platform/attachments/do150.py index 52cddb9..44ba568 100644 --- a/clearpath_config/platform/attachments/do150.py +++ b/clearpath_config/platform/attachments/do150.py @@ -28,26 +28,25 @@ from clearpath_config.common.types.accessory import Accessory from clearpath_config.common.types.platform import Platform from clearpath_config.platform.types.attachment import BaseAttachment, PlatformAttachment +from clearpath_config.platform.attachments.dd100 import DD100TopPlate from typing import List -class DO150TopPlate(BaseAttachment): +class DO150TopPlate(DD100TopPlate): PLATFORM = Platform.DO150 ATTACHMENT_MODEL = "%s.top_plate" % PLATFORM - PACS = "pacs" - MODELS = [PACS] - PARENT = "default_mount" def __init__( self, name: str = ATTACHMENT_MODEL, - model: str = PACS, + model: str = DD100TopPlate.PACS, enabled: bool = BaseAttachment.ENABLED, - parent: str = PARENT, + height: float = DD100TopPlate.HEIGHT, + parent: str = DD100TopPlate.PARENT, xyz: List[float] = Accessory.XYZ, rpy: List[float] = Accessory.RPY ) -> None: - super().__init__(name, model, enabled, parent, xyz, rpy) + super().__init__(name, model, enabled, height, parent, xyz, rpy) # DO150 Attachments diff --git a/clearpath_config/platform/attachments/r100.py b/clearpath_config/platform/attachments/r100.py index c9f4aa5..1bef1d0 100644 --- a/clearpath_config/platform/attachments/r100.py +++ b/clearpath_config/platform/attachments/r100.py @@ -31,34 +31,125 @@ from clearpath_config.platform.types.attachment import BaseAttachment, PlatformAttachment -class R100ArmMount(BaseAttachment): +class R100FAMS(BaseAttachment): PLATFORM = Platform.R100 - ATTACHMENT_MODEL = "%s.arm_mount" % PLATFORM - FAMS = "fams" - HAMS = "hams" - TOWER = "tower" - MODELS = [FAMS, HAMS, TOWER] - DEFAULT = TOWER + ATTACHMENT_MODEL = "%s.fams" % PLATFORM + DEFAULT = "default" + MODELS = [DEFAULT] PARENT = "default_mount" + TABLE_HEIGHT = 0.3 def __init__( self, name: str = ATTACHMENT_MODEL, model: str = DEFAULT, + table_height: float = TABLE_HEIGHT, enabled: bool = BaseAttachment.ENABLED, parent: str = PARENT, xyz: List[float] = Accessory.XYZ, - rpy: List[float] = Accessory.RPY + rpy: List[float] = Accessory.RPY, ) -> None: super().__init__(name, model, enabled, parent, xyz, rpy) + self.table_height = table_height + + def to_dict(self) -> dict: + d = super().to_dict() + d['table_height'] = self.table_height + return d + + def from_dict(self, d: dict) -> None: + super().from_dict(d) + if 'table_height' in d: + self.table_height = d['table_height'] + return d + + +class R100HAMS(BaseAttachment): + PLATFORM = Platform.R100 + ATTACHMENT_MODEL = "%s.hams" % PLATFORM + DEFAULT = "default" + MODELS = [DEFAULT] + PARENT = "default_mount" + TABLE_HEIGHT = 0.6 + MOUNT_HEIGHT = 0.3 + + def __init__( + self, + name: str = ATTACHMENT_MODEL, + model: str = DEFAULT, + table_height: float = TABLE_HEIGHT, + mount_height: float = MOUNT_HEIGHT, + enabled: bool = BaseAttachment.ENABLED, + parent: str = PARENT, + xyz: List[float] = Accessory.XYZ, + rpy: List[float] = Accessory.RPY, + ) -> None: + super().__init__(name, model, enabled, parent, xyz, rpy) + self.table_height = table_height + self.mount_height = mount_height + + def to_dict(self) -> dict: + d = super().to_dict() + d['table_height'] = self.table_height + d['mount_height'] = self.mount_height + return d + + def from_dict(self, d: dict) -> None: + super().from_dict(d) + if 'table_height' in d: + self.table_height = d['table_height'] + if 'mount_height' in d: + self.mount_height = d['mount_height'] + return d + + +class R100Tower(BaseAttachment): + PLATFORM = Platform.R100 + ATTACHMENT_MODEL = "%s.tower" % PLATFORM + DEFAULT = "default" + MODELS = [DEFAULT] + PARENT = "default_mount" + LEFT_HEIGHT = 0.0 + RIGHT_HEIGHT = 0.0 + + def __init__( + self, + name: str = ATTACHMENT_MODEL, + model: str = DEFAULT, + enabled: bool = BaseAttachment.ENABLED, + parent: str = PARENT, + left_height: float = LEFT_HEIGHT, + right_height: float = RIGHT_HEIGHT, + xyz: List[float] = Accessory.XYZ, + rpy: List[float] = Accessory.RPY, + ) -> None: + super().__init__(name, model, enabled, parent, xyz, rpy) + self.left_height = left_height + self.right_height = right_height + + def to_dict(self) -> dict: + d = super().to_dict() + d['left_height'] = self.left_height + d['right_height'] = self.right_height + + def from_dict(self, d: dict) -> None: + super().from_dict(d) + if 'left_height' in d: + self.left_height = d['left_height'] + if 'right_height' in d: + self.right_height = d['right_height'] # R100 Attachments class R100Attachment(PlatformAttachment): PLATFORM = Platform.R100 # Arm Mount - ARM_MOUNT = R100ArmMount.ATTACHMENT_MODEL + HAMS = R100HAMS.ATTACHMENT_MODEL + FAMS = R100FAMS.ATTACHMENT_MODEL + TOWER = R100Tower.ATTACHMENT_MODEL TYPES = { - ARM_MOUNT: R100ArmMount + HAMS: R100HAMS, + FAMS: R100FAMS, + TOWER: R100Tower }