Skip to content

Commit

Permalink
feat(mqtt): Optionally expose ObstacleAvoidanceControlCapability
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Jun 8, 2024
1 parent 572e3ce commit 9866d94
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion backend/lib/doc/Configuration.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@
"CurrentStatisticsCapability",
"TotalStatisticsCapability",
"SpeakerVolumeControlCapability",
"KeyLockCapability"
"KeyLockCapability",
"ObstacleAvoidanceControlCapability"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const SimpleToggleCapabilityMqttHandle = require("./SimpleToggleCapabilityMqttHandle");


class ObstacleAvoidanceControlCapabilityMqttHandle extends SimpleToggleCapabilityMqttHandle {}

ObstacleAvoidanceControlCapabilityMqttHandle.OPTIONAL = true;

module.exports = ObstacleAvoidanceControlCapabilityMqttHandle;
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ class SimpleToggleCapabilityMqttHandle extends CapabilityMqttHandle {
}

const CAPABILITIES_TO_FRIENDLY_NAME_MAPPING = {
[capabilities.KeyLockCapability.TYPE]: "Lock keys",
[capabilities.KeyLockCapability.TYPE]: "Lock Keys",
[capabilities.ObstacleAvoidanceControlCapability.TYPE]: "Obstacle Avoidance",
};

const CAPABILITIES_TO_ICON_MAPPING = {
[capabilities.KeyLockCapability.TYPE]: "mdi:lock",
[capabilities.ObstacleAvoidanceControlCapability.TYPE]: "mdi:cable-data",
};

module.exports = SimpleToggleCapabilityMqttHandle;
1 change: 1 addition & 0 deletions backend/lib/mqtt/capabilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
KeyLockCapabilityMqttHandle: require("./KeyLockCapabilityMqttHandle"),
LocateCapabilityMqttHandle: require("./LocateCapabilityMqttHandle"),
MapSegmentationCapabilityMqttHandle: require("./MapSegmentationCapabilityMqttHandle"),
ObstacleAvoidanceControlCapabilityMqttHandle: require("./ObstacleAvoidanceControlCapabilityMqttHandle"),
PresetSelectionCapabilityMqttHandle: require("./PresetSelectionCapabilityMqttHandle"),
SpeakerVolumeControlCapabilityMqttHandle: require("./SpeakerVolumeControlCapabilityMqttHandle"),
TotalStatisticsCapabilityMqttHandle: require("./TotalStatisticsCapabilityMqttHandle"),
Expand Down
3 changes: 2 additions & 1 deletion backend/lib/mqtt/handles/HandleMappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const CAPABILITY_TYPE_TO_HANDLE_MAPPING = {
[capabilities.CurrentStatisticsCapability.TYPE]: capabilityHandles.CurrentStatisticsCapabilityMqttHandle,
[capabilities.TotalStatisticsCapability.TYPE]: capabilityHandles.TotalStatisticsCapabilityMqttHandle,
[capabilities.SpeakerVolumeControlCapability.TYPE]: capabilityHandles.SpeakerVolumeControlCapabilityMqttHandle,
[capabilities.KeyLockCapability.TYPE]: capabilityHandles.KeyLockCapabilityMqttHandle
[capabilities.KeyLockCapability.TYPE]: capabilityHandles.KeyLockCapabilityMqttHandle,
[capabilities.ObstacleAvoidanceControlCapability.TYPE]: capabilityHandles.ObstacleAvoidanceControlCapabilityMqttHandle
};

const STATUS_ATTR_TO_HANDLE_MAPPING = [
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/robot/RobotOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const KeyLockCapabilitySwitchListMenuItem = () => {
}}
disabled={disabled}
loadError={isError}
primaryLabel={"Lock keys"}
primaryLabel={"Lock Keys"}
secondaryLabel={"Prevents the robot from being operated using its physical buttons."}
icon={<KeyLockIcon/>}
/>
Expand Down

0 comments on commit 9866d94

Please sign in to comment.