Open JohnRev opened 5 years ago
I'm also seeing:
get_fresh_map_v2
get_fresh_map
get_persist_map_v2
get_persist_map
It is also possible that persistent maps are stored in the mii cloud and downloaded if requested.
_3.3.9001633
Lab mode ON:
req: {'from': '4', 'id': ##MESSAGE_ID##, 'method': 'set_lab_status', 'params': [1]}
res: {'id': ##MESSAGE_ID##, 'result': ['ok']}
Lab mode OFF:
req: {'from': '4', 'id': ##MESSAGE_ID##, 'method': 'set_lab_status', 'params': [0]}
res: {'id': ##MESSAGE_ID##, 'result': ['ok']}
Software barrier:
req: {'from': '4', 'id': 666, 'method': 'save_map', 'params': [[1, 33800, 27850, 34900, 28700]]}
res: {'id': ##MESSAGE_ID##, 'result': ['ok']}
No-go zone:
req: {'from': '4', 'id': ##MESSAGE_ID##, 'method': 'save_map', 'params': [[0, 27000, 32000, 30750, 32000, 30750, 30250, 27000, 30250]]}
res: {'id': ##MESSAGE_ID##, 'result': ['ok']}
Thanks for sharing these, @FeatureExpert!! The params of software barrier and no-go zones seem like coordinates? Software barrier takes a vector of [id, x1,y1,x2,y2] And no-go zone takes [id, x1,y1,x2,y2,x3,y3,x4,y4], which are the corners of the zone rectangle? Edit: see @JensBuchta's comment. The first parameter appears to be a type: 0 = zone, 1 = barrier
It looks like these features are yet to be ported to the Gen 1 Firmware. But given the similarities I would hope to see it soon
I'm not sure these numbers. Some kind of coordinates for sure, but I do not know yet how to calculate them correctly. My image with the map is 900x767, so the coordinates does not match the size. But maybe I generate map incorrectly...
Hi,
This may be a stupid question but how can you get the list of the commands ? I did not find any explanation of the robot API.
Thanks
@FeatureExpert I guess they would be like the zoned_cleanup
coordinate system, where the dock is at (2500,2500) or something like that
You are probably right. So we can set coords as follows counting from bottom left corner and where the dock is at [25500, 25500]:
[id, barrier_start_x, barrier_start_y, barrier_end_x, barrier_end_y]
or
[id, zone_top_left_x, zone_top_left_y, zone_top_right_x, zone_top_right_y, zone_bottom_right_x, zone_bottom_right_y, zone_bottom_left_x, zone_bottom_left_y]
or even barrier and no-go zone in one command:
[[id, barrier_start_x, barrier_start_y, barrier_end_x, barrier_end_y], [id, zone_top_left_x, zone_top_left_y, zone_top_right_x, zone_top_right_y, zone_bottom_right_x, zone_bottom_right_y, zone_bottom_left_x, zone_bottom_left_y]]
Seems the first argument of the array is not an id, but rather a type: 0 = zone, 1 = barrier. I can create multiple zones with 0, one zone 0, next zone 1 didn't work. Tested with FW 1633.
@JensBuchta nice find!
You are probably right. So we can set coords as follows counting from bottom left corner and where the dock is at [25500, 25500]:
[id, barrier_start_x, barrier_start_y, barrier_end_x, barrier_end_y]
or
[id, zone_top_left_x, zone_top_left_y, zone_top_right_x, zone_top_right_y, zone_bottom_right_x, zone_bottom_right_y, zone_bottom_left_x, zone_bottom_left_y]
or even barrier and no-go zone in one command:
[[id, barrier_start_x, barrier_start_y, barrier_end_x, barrier_end_y], [id, zone_top_left_x, zone_top_left_y, zone_top_right_x, zone_top_right_y, zone_bottom_right_x, zone_bottom_right_y, zone_bottom_left_x, zone_bottom_left_y]]
sorry for my stupid question : how are no-go zones and barriers removed or how can i see these zones or barriers ?
Calling get_persistent_map_v1
triggers a map upload. However I'm not sure what the param does. With the new Valetudo which supports map uploading, I've added a log message and it uploads a map each time I call it.
It looks like it is a slot, it seems you can switch between 0 and 1.
asn (e) venv ~ workspace rockrobo miio mirobo raw-command get_persist_map_v1 1
Sending cmd get_persist_map_v1 with params 1
['retry']
asn (e) venv ~ workspace rockrobo miio mirobo raw-command get_persist_map_v1 0
Sending cmd get_persist_map_v1 with params 0
['map_upload_handler']
asn (e) venv ~ workspace rockrobo miio mirobo raw-command get_persist_map_v1 0
Sending cmd get_persist_map_v1 with params 0
['retry']
asn (e) venv ~ workspace rockrobo miio mirobo raw-command get_persist_map_v1 1
Sending cmd get_persist_map_v1 with params 1
['map_upload_handler']
get_persist_map_v1
only works after save_map
. If you do a reset_map
it doesn't work anmyore.
So how do you remove virtual walls and no-go zones?
Any news on this, did someone figure out how to delete virtual walls or no-go zones, or how to reset all virtual walls + all no go-zones with some kind of reset (without loosing the peristant map)?
Maybe the original app doesn't delete single entities, but resets all and re-builds the other ones.
If you want to remove all walls and zones:
{'from': '4', 'id': 666, 'method': 'save_map', 'params': []}
If you want to remove one part, you parse the current map file, remove the part you don't want and call save_map with the params you want.
Can we somehow edit map background in a user friendly way? What I mean is... e,g, when robot scans near a mirror - there are beams drawn on a map that go outside the room\house (the screen taken from Valetudo, but it shouldn't matter). I'd like to clean up the map for it to look nicer. I have map json file downloaded, but it's 700kb of text\numbers, so really hard to track each point's coordinates. Thus some app/UI would be nice.
This is nothing you can simply set in the request, nor is there an obvious way to avoid it. The Xiaomi cloud offers a basic bitmap with the colors including the reflections you see.
Besides that it offers the location of the various objects & tracks etc.
You might be able to create a client that does some smart things to the bitmap, to determine if it is part of a larger(largest) cloud of pixels or something, but that would be totally client dependent.
Hello,
I came upon the following commands on a gen2 vacuum with v001780 firmware:
mirobo raw-command set_lab_status 1
allows the robot to "remember" maps after a reboot. Thestart_edit_map
,end_edit_map
, andsave_map
appear to be related to the virtual walls and forbidden zones functionality. I believe a JSON is expected as parameters for the function. I do not have the xiaomi app, and I was not able to figure out the format of these parameters.Note that calling
start_edit_map
,end_edit_map
, orsave_map
without first enabling the lab_status will result in the following response:The Lab Status is disable
.Not sure what the
use_new_map
,use_old_map
, andget_persist_map
do.