Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CollisionAvoidantNavigationControlCapability
- Loading branch information
Showing
22 changed files
with
307 additions
and
7 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
backend/lib/core/capabilities/CollisionAvoidantNavigationControlCapability.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const SimpleToggleCapability = require("./SimpleToggleCapability"); | ||
|
||
/** | ||
* @template {import("../ValetudoRobot")} T | ||
* @extends SimpleToggleCapability<T> | ||
*/ | ||
class CollisionAvoidantNavigationControlCapability extends SimpleToggleCapability { | ||
getType() { | ||
return CollisionAvoidantNavigationControlCapability.TYPE; | ||
} | ||
} | ||
|
||
CollisionAvoidantNavigationControlCapability.TYPE = "CollisionAvoidantNavigationControlCapability"; | ||
|
||
module.exports = CollisionAvoidantNavigationControlCapability; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
backend/lib/robots/dreame/capabilities/DreameAutoEmptyDockAutoEmptyControlCapability.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
backend/lib/robots/dreame/capabilities/DreameCollisionAvoidantNavigationControlCapability.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const CollisionAvoidantNavigationControlCapability = require("../../../core/capabilities/CollisionAvoidantNavigationControlCapability"); | ||
const DreameMiotHelper = require("../DreameMiotHelper"); | ||
const DreameUtils = require("../DreameUtils"); | ||
|
||
/** | ||
* @extends CollisionAvoidantNavigationControlCapability<import("../DreameValetudoRobot")> | ||
*/ | ||
class DreameCollisionAvoidantNavigationControlCapability extends CollisionAvoidantNavigationControlCapability { | ||
|
||
/** | ||
* @param {object} options | ||
* @param {import("../DreameValetudoRobot")} options.robot | ||
* | ||
* @param {number} options.siid MIOT Service ID | ||
* @param {number} options.piid MIOT Property ID | ||
*/ | ||
constructor(options) { | ||
super(options); | ||
|
||
this.siid = options.siid; | ||
this.piid = options.piid; | ||
|
||
this.helper = new DreameMiotHelper({robot: this.robot}); | ||
} | ||
|
||
/** | ||
* | ||
* @returns {Promise<boolean>} | ||
*/ | ||
async isEnabled() { | ||
const res = await this.helper.readProperty(this.siid, this.piid); | ||
const deserializedResponse = DreameUtils.DESERIALIZE_MISC_TUNABLES(res); | ||
|
||
return deserializedResponse.LessColl === 1; | ||
} | ||
|
||
/** | ||
* @returns {Promise<void>} | ||
*/ | ||
async enable() { | ||
await this.helper.writeProperty( | ||
this.siid, | ||
this.piid, | ||
DreameUtils.SERIALIZE_MISC_TUNABLES_SINGLE_TUNABLE({ | ||
LessColl: 1 | ||
}) | ||
); | ||
} | ||
|
||
/** | ||
* @returns {Promise<void>} | ||
*/ | ||
async disable() { | ||
await this.helper.writeProperty( | ||
this.siid, | ||
this.piid, | ||
DreameUtils.SERIALIZE_MISC_TUNABLES_SINGLE_TUNABLE({ | ||
LessColl: 0 | ||
}) | ||
); | ||
} | ||
} | ||
|
||
module.exports = DreameCollisionAvoidantNavigationControlCapability; |
2 changes: 1 addition & 1 deletion
2
backend/lib/robots/dreame/capabilities/DreameObstacleAvoidanceControlCapability.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
backend/lib/robots/dreame/capabilities/DreamePetObstacleAvoidanceControlCapability.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
.../lib/robots/roborock/capabilities/RoborockCollisionAvoidantNavigationControlCapability.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const CollisionAvoidantNavigationControlCapability = require("../../../core/capabilities/CollisionAvoidantNavigationControlCapability"); | ||
|
||
/** | ||
* @extends CollisionAvoidantNavigationControlCapability<import("../RoborockValetudoRobot")> | ||
*/ | ||
class RoborockCollisionAvoidantNavigationControlCapability extends CollisionAvoidantNavigationControlCapability { | ||
|
||
/** | ||
* @returns {Promise<boolean>} | ||
*/ | ||
async isEnabled() { | ||
const res = await this.robot.sendCommand("get_collision_avoid_status", [], {}); | ||
|
||
return res["status"] === 1; | ||
} | ||
|
||
/** | ||
* @returns {Promise<void>} | ||
*/ | ||
async enable() { | ||
await this.robot.sendCommand("set_collision_avoid_status", {"status": 1}, {}); | ||
} | ||
|
||
/** | ||
* @returns {Promise<void>} | ||
*/ | ||
async disable() { | ||
await this.robot.sendCommand("set_collision_avoid_status", {"status": 0}, {}); | ||
} | ||
} | ||
|
||
module.exports = RoborockCollisionAvoidantNavigationControlCapability; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.