Skip to content

Commit

Permalink
Merge pull request #75 from clearpathrobotics/lcamero/0.3-attachments
Browse files Browse the repository at this point in the history
0.3 Attachments
  • Loading branch information
luis-camero committed Sep 9, 2024
2 parents 1eec378 + 031dc41 commit 24eafd1
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 31 deletions.
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
}

0 comments on commit 24eafd1

Please sign in to comment.