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

0.3 Attachments #75

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions clearpath_config/platform/attachments/dd100.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions clearpath_config/platform/attachments/dd150.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions clearpath_config/platform/attachments/do100.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions clearpath_config/platform/attachments/do150.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
111 changes: 101 additions & 10 deletions clearpath_config/platform/attachments/r100.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Loading