Skip to content

Commit

Permalink
refactor(vendor.dreame): Add more AI classifier IDs and pull the cons…
Browse files Browse the repository at this point in the history
…tant into DreameUtils
  • Loading branch information
Hypfer committed Sep 14, 2024
1 parent 90e5ab9 commit 0928cf0
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 17 deletions.
19 changes: 2 additions & 17 deletions backend/lib/robots/dreame/DreameMapParser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const DreameUtils = require("./DreameUtils");
const Logger = require("../../Logger");
const mapEntities = require("../../entities/map");
const uuid = require("uuid");
Expand Down Expand Up @@ -267,7 +268,7 @@ class DreameMapParser {
parseFloat(obstacle[0]),
parseFloat(obstacle[1])
);
const type = OBSTACLE_TYPES[obstacle[2]] ?? `Unknown ID ${obstacle[2]}`;
const type = DreameUtils.AI_CLASSIFIER_IDS[obstacle[2]] ?? `Unknown ID ${obstacle[2]}`;
const confidence = `${Math.round(parseFloat(obstacle[3])*100)}%`;
const image = obstacle[5] !== undefined ? obstacle[5] : undefined;

Expand Down Expand Up @@ -631,22 +632,6 @@ const PATH_OPERATORS = {
RELATIVE_LINE: "L"
};

const OBSTACLE_TYPES = {
"128": "Pedestal",
"129": "Bathroom Scale",
"130": "Power Strip",
"132": "Toy",
"133": "Shoe",
"134": "Sock",
"135": "Feces",
"136": "Trash Can",
"137": "Fabric",
"138": "Cable",
"139": "Stain",
"142": "Obstacle",
"158": "Pet"
};

/**
* @typedef {string} MapDataType
* @enum {string}
Expand Down
84 changes: 84 additions & 0 deletions backend/lib/robots/dreame/DreameUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,90 @@ class DreameUtils {
}
}

// It seems that everything the AI models can detect shares the same ID space
DreameUtils.AI_CLASSIFIER_IDS = Object.freeze({
"0": "Unknown",
"1": "Bedside Table",
"2": "Wall Air Conditioner",
"3": "Chair",
"4": "Unknown",
"5": "End Table",
"6": "TV Monitor",
"7": "TV Cabinet",
"8": "Dining Table",
"9": "Range Hood",
"10": "Cupboard",
"11": "Gas Water Heater",
"12": "Toilet",
"13": "Shower Head",
"14": "Electric Water Heater",
"15": "Refrigerator",
"16": "Washer Dryer",

"32": "Unknown",

"40": "Unknown",
"41": "Balcony",
"42": "Bathroom",
"43": "Bedroom",
"44": "Corridor",
"45": "Dining Room",
"46": "Kitchen",
"47": "Living Room",


"128": "Pedestal",
"129": "Bathroom Scale",
"130": "Power Strip",
"131": "Unknown",
"132": "Toy",
"133": "Shoes",
"134": "Sock",
"135": "Feces",
"136": "Trash Can",
"137": "Fabric",
"138": "Cable", // Thread?
"139": "Stain",
"140": "Dock Entrance",
"141": "Dock",
"142": "Obstacle", // Ambiguous obstacle
"143": "Black Desk Leg",

"144": "Roller",
"145": "Sweeper",
"146": "Cleaning Robot",

"147": "Ambiguous Other",
"148": "Carpet Segment",
"149": "Ground",
"150": "Carpet",
"151": "Unknown",
"152": "Ceramic",

"157": "Human",
"158": "Pet",

"159": "Furniture Leg",
"160": "Furniture Leg Black",
"161": "Wheel",
"162": "Robot Cleaner",
"163": "Cleaner",
"164": "Unknown",
"165": "Bottle",
"166": "Unknown",
"167": "Pet Bowl",
"168": "Mirror",

"169": "Stain need filter", //??

"170": "Hand Gesture Unknown",
"171": "Hand Gesture Stop",
// Various body key points I'm not going to document here because they'll certainly only be used within the robots
// firmware for some kind of gesture control

"201": "Bar Stool", // Might also be any kind of furniture that can act as a prison for the robot that can be entered but not left
});

/**
* @typedef {object} AI_SETTINGS
* @property {boolean} obstacleDetection
Expand Down

0 comments on commit 0928cf0

Please sign in to comment.