Skip to content

Commit

Permalink
Added wheel parameter to platform
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-camero committed Dec 5, 2023
1 parent d04c980 commit 283d5aa
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion clearpath_config/platform/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class PlatformConfig(BaseConfig):
CONTROL = "control"
# Battery
BATTERY = "battery"
# Wheel
WHEEL = "wheel"

TEMPLATE = {
PLATFORM: {
Expand All @@ -147,6 +149,7 @@ class PlatformConfig(BaseConfig):
LAUNCH: LAUNCH,
CONTROL: CONTROL,
BATTERY: BATTERY,
WHEEL: WHEEL,
}
}

Expand All @@ -161,6 +164,7 @@ class PlatformConfig(BaseConfig):
LAUNCH: "",
CONTROL: "",
BATTERY: BatteryConfig.DEFAULTS,
WHEEL: "default",
}

def __init__(
Expand All @@ -170,6 +174,7 @@ def __init__(
attachments: str = DEFAULTS[ATTACHMENTS],
battery: dict = DEFAULTS[BATTERY],
extras: dict = DEFAULTS[EXTRAS],
wheel: dict = DEFAULTS[WHEEL],
) -> None:
# Initialization
self._config = {}
Expand All @@ -180,12 +185,14 @@ def __init__(
self.description = self.DEFAULTS[self.DESCRIPTION]
self.launch = self.DEFAULTS[self.LAUNCH]
self.control = self.DEFAULTS[self.CONTROL]
self.wheel = self.DEFAULTS[self.WHEEL]
# Setter Template
setters = {
self.KEYS[self.CONTROLLER]: PlatformConfig.controller,
self.KEYS[self.ATTACHMENTS]: PlatformConfig.attachments,
self.KEYS[self.BATTERY]: PlatformConfig.battery,
self.KEYS[self.EXTRAS]: PlatformConfig.extras
self.KEYS[self.EXTRAS]: PlatformConfig.extras,
self.KEYS[self.WHEEL]: PlatformConfig.wheel,
}
super().__init__(setters, config, self.PLATFORM)

Expand Down Expand Up @@ -335,3 +342,15 @@ def battery(self, value: dict | BatteryConfig) -> None:
isinstance(value, BatteryConfig)), (
"Battery configuration must be of type 'dict' or 'BatteryConfig'"
)

@property
def wheel(self) -> str:
self.set_config_param(
key=self.KEYS[self.WHEEL],
value=self._wheel
)
return self._wheel

@wheel.setter
def wheel(self, value: str) -> None:
self._wheel = value

0 comments on commit 283d5aa

Please sign in to comment.