-
-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add control for persistent maps, no-go zones and barriers (#438)
* Add some map editing commands Completely untested for now, works only on gen2 and requires a fairly recent firmware version supporting no-go zones and barriers. Based on information from marcelrv/XiaomiRobotVacuumProtocol#15 * Add parameters to no-go zone, fix type handling
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
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
bce9a29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rytilahti, sorry to bother you, but I couldn't find any sample on how to use these functions. I assume I have to call them in some sequence to add a nogo zone? Also, is it possible to delete nogo zones somehow? Thanks!
bce9a29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cbruegg, unfortunately I don't really know how they do work, expect that the "lab mode" has to turned on in order to execute the other commands, so I cannot help you there.
Maybe switching it on and off will reset the existing zones? I commited it in in hopes of someone coming around and helping to make sense to these and document them alongside :-)
bce9a29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick response! I'll have to tinker with them then. If I find out anything, I'll submit a PR with docs.
bce9a29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
bce9a29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, so I don't know enough about this
@command
framework to make a PR, but here's what I've discovered:Whenever I issue a command to the
save_map
API, the list of barriers and nogo-zones I pass in override the previously saved zones. That is, if I pass in an empty list, it clears all nogo-zones and barriers. This has the effect thatcreate_software_barrier
andcreate_nogo_zone
clear everything else.I'd suggest adding a method that just takes a list of lists and calls the
save_map
API. To give you an idea how the API works, here's a snippet that works for me:There seems to be no requirement to call
start_edit_map
andend_edit_map
. I've tinkered with these methods, but I couldn't figure out what they are useful for. I also had no success with getting the currently stored zones and barriers.bce9a29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! So the command decorator is in principle quite simple to use, it just wraps regular functions (and makes them accessible for the console tool, eacho @command wrapped function is available when calling
miiocli vacuum
, for Vacuum class' commands that is).But anyway, sounds like the interface needs a bit adapting, could you please copy create an issue with your comment so it doesn't get forgotten.