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

Cherry-pick enable_ekf support from Jazzy #108

Merged
merged 2 commits into from
Dec 19, 2024
Merged
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
22 changes: 21 additions & 1 deletion clearpath_config/platform/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def parameters(self, value: dict) -> None:
class PlatformConfig(BaseConfig):

PLATFORM = "platform"

# Controllers
PS4 = "ps4"
LOGITECH = "logitech"
Expand All @@ -101,6 +102,8 @@ class PlatformConfig(BaseConfig):
BATTERY = "battery"
# Wheel
WHEEL = "wheel"
# Enable/disable EKF
ENABLE_EKF = 'enable_ekf'

TEMPLATE = {
PLATFORM: {
Expand All @@ -113,6 +116,7 @@ class PlatformConfig(BaseConfig):
CONTROL: CONTROL,
BATTERY: BATTERY,
WHEEL: WHEEL,
ENABLE_EKF: ENABLE_EKF
}
}

Expand All @@ -129,6 +133,7 @@ class PlatformConfig(BaseConfig):
CONTROL: "",
BATTERY: BatteryConfig.DEFAULTS,
WHEEL: "default",
ENABLE_EKF: True,
}

def __init__(
Expand All @@ -140,6 +145,7 @@ def __init__(
battery: dict = DEFAULTS[BATTERY],
extras: dict = DEFAULTS[EXTRAS],
wheel: dict = DEFAULTS[WHEEL],
enable_ekf: bool = DEFAULTS[ENABLE_EKF],
) -> None:
# Initialization
self._config = {}
Expand All @@ -151,7 +157,8 @@ 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]
self.wheel = wheel
self.enable_ekf = enable_ekf
# Setter Template
setters = {
self.KEYS[self.CONTROLLER]: PlatformConfig.controller,
Expand All @@ -160,6 +167,7 @@ def __init__(
self.KEYS[self.BATTERY]: PlatformConfig.battery,
self.KEYS[self.EXTRAS]: PlatformConfig.extras,
self.KEYS[self.WHEEL]: PlatformConfig.wheel,
self.KEYS[self.ENABLE_EKF]: PlatformConfig.enable_ekf
}
super().__init__(setters, config, self.PLATFORM)

Expand Down Expand Up @@ -334,3 +342,15 @@ def wheel(self) -> str:
@wheel.setter
def wheel(self, value: str) -> None:
self._wheel = value

@property
def enable_ekf(self) -> bool:
self.set_config_param(
key=self.KEYS[self.ENABLE_EKF],
value=self._enable_ekf
)
return self._enable_ekf

@enable_ekf.setter
def enable_ekf(self, value: bool) -> None:
self._enable_ekf = value