Skip to content

Update the calibration matrix based on SVG viewbox#715

Open
philek wants to merge 2 commits intoPiotrMachowski:devfrom
philek:feature/deebot-svg-viewbox
Open

Update the calibration matrix based on SVG viewbox#715
philek wants to merge 2 commits intoPiotrMachowski:devfrom
philek:feature/deebot-svg-viewbox

Conversation

@philek
Copy link

@philek philek commented Feb 25, 2024

This is my attempt to make the card correctly calibrate the map to vacuum coordinates for Ecovacs.

After the changes in DeebotUniverse/client.py#433 that align the center of the vacuum map and svg generated it is a simple matter of setting the correct scale (1/50), flipping y and then offsetting the map coordinates by the viewbox.
As far as I could figure out, there is no way to get any of the SVG metadata from an img tag, that's why I added an object next to it. If you like I could add it only for ecovacs vacuums.

I had some issues introducing this change without creating an (almost) endless rendering loop, but I think I've finally gotten it sorted out.

@philek philek marked this pull request as ready for review February 25, 2024 15:48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since HA 2024.2 the custom component is merged into the cores Ecovacs integration and I will archive the custom component soon. I think this file needs to be renamed

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any functional changes related to this card because of it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the migration itself has no functional changes.
With the release of 3.1.0 the integration switched from png to SVG and that change can caused some functional changes. As I don't use your card, I completely forgotten to test it.

The core integration uses also the SVG image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, do I need to make some changes? In either PR? Or just be patient?

@philek
Copy link
Author

philek commented Feb 27, 2024

Not really sure why that check is failing.

@PiotrMachowski
Copy link
Owner

Not really sure why that check is failing.

Don't worry about it :)

@philek
Copy link
Author

philek commented Mar 2, 2024

Did some more tests and found that it didn't work as expected in Chrome. Couldn't find a good way to check if image is SVG without loading it in an object tag. Checking naturalWidth == 0 only works on Firefox. Decided instead to add a flag for the deebot platform that enables this additional SVG logic. Other platforms should be more or less unchanged.

@philek philek force-pushed the feature/deebot-svg-viewbox branch from 134a577 to 109ce76 Compare March 8, 2024 21:24
@jspayd jspayd mentioned this pull request May 18, 2025
3 tasks
@jspayd
Copy link

jspayd commented May 18, 2025

Thanks for the work on this! Not sure if you're planning on working more on this, but in case this info is helpful, this nearly fixes the issue for me except that the y-calibration is incorrect and still inconsistent across platforms. I've tried this change using Chrome for macOS, Firefox for macOS, and the Home Assistant iOS app, and I'm using a Deebot Ozmo T8.

These calibration points work for me on Chrome and Firefox:

  calibration_points:
    - vacuum:
        x: 0
        "y": 0
      map:
        x: 0
        "y": 15
    - vacuum:
        x: 50
        "y": 0
      map:
        x: 1
        "y": 15
    - vacuum:
        x: 0
        "y": -50
      map:
        x: 0
        "y": 16

And these are the ones that I need for the HA iOS app:

  calibration_points:
    - vacuum:
        x: 0
        "y": 0
      map:
        x: 0
        "y": 19
    - vacuum:
        x: 50
        "y": 0
      map:
        x: 1
        "y": 19
    - vacuum:
        x: 0
        "y": -50
      map:
        x: 0
        "y": 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments