Closed michaelblight closed 5 years ago
Thank you for your suggestion, I have already started to redesign current calibration process to make it simpler, more universal and more accurate. User will have to provide 3 points in both image and vacuum coordinates. This will make sure that calibration is always correct for any given points.
Do you know if there's any logic with the map coordinates? For example if 1000 points in the map was 1 metre, during config you could easily roughly guess coords that work in your house, and get the vacuum to go there, and then confirm by clicking on the image.
Something else I noticed is the image coordinates probably need to be specified as percentages. On different screen sizes the image scales automatically, so the image might have been one width/height during config, but a different size now. With the base/reference positions as absolute positions, they "move" if the image size changes. Percentages would overcome this.
Theoretically 1 point = 1mm, but I don't think it is reliable enough, as (25500, 25500) is not always exact position of a dock.
I know that image size is changing, the card is handling it properly (scale is calculated according to size of the card). Defining coordinates in pixels is much easier: values are shown by probably every image editing software.
I think the problem I was having was that the image scale is only calculated once when the screen loads. If you change the screen size (eg. collapse the HA toolbar on the left) the image rescales (and loses aspect ratio) and then the coordinates are wrong. But I'm still struggling to get a zone from base to reference to match the image coordinates. If you're redoing how the coords work, I might wait for that before using it. Happy to offer help though.
Unfortunately so far I haven't found a way to keep aspect ratio after change of width, so map is "fixed" after first click.
If you want to get coordinates in the same system as base_position
and reference_point
you have to divide them by this.imageScale
Hi @michaelblight, I have just published a new version of a card with added support for user-defined calibration points. It should address your problems
I used
vacuum.send_command
to go to the base position and the reference position. I'm sort of assuming the base position is where the vacuum docks - going to (25500, 25500) causes it to jiggle around near the dock. And going to (26500, 26500) is presumably forward and to the right from there. Except that would be in my neighbours house.I thought I would PR a suggested improvement to be able to specify a different reference point in map coordinates, so I forked the code and created a dev branch. Then I drew red circles at the base and reference points, as well as writing the coordinates to the console on mouse down (if debug was true).
If I click where the dock is, I can enter these coords into the config, and after reloading I get a red circle in the right place. But if I click it with this point configured, it does not show in the console as (25500, 25500), so I'm not sure what's going on. Obviously it shouldn't matter if the reference point is wrong, as the base point should effectively be (0, 0).
It started getting late so I gave up for the night. But I thought I'd let you know in case you had some ideas.