anki / cozmo-python-sdk

Anki Cozmo Python SDK
Other
662 stars 430 forks source link

Update annotate.py #171

Closed AndreiCostinescu closed 6 years ago

AndreiCostinescu commented 6 years ago

Changed documentation of property "priority" of the cozmo.annotate.Annotator class such that in the official documentation the whole text will be displayed.

AndreiCostinescu commented 6 years ago

Hi, I have a question regarding the documentation of the priority. In the cozmo.annotate.ImageAnnotator class it is said that a higher priority will be "rendered" first (with the possibility of being overwritten by annotations with lower priorities). However, in the documentation of the priority property in the cozmo.annotate.Annotator class, it is said that

Annotators with lower numbered priorities are applied first.

Does the documentation have the same meaning? I.e. will an annotator with a low priority (small number) be applied first in the image?

If that is the case, I would suggest changing the formulation of the documentation to make it a bit clearer. Something similar to what I wrote above: "Annotators with a low priority (small priority value) will be applied first on the image."

MarkWez commented 6 years ago

@AndreiCostinescu Questions about the SDK are best asked on https://forums.anki.com/ - in this case the annotators are sorted in reverse - so largest priorities first:

    def _sort_annotators(self):
        self._sorted_annotators = sorted(self._annotators.values(),
                key=lambda an: an.priority, reverse=True)

and later applied in that sorted order, so the description at the top of the class is correct, but the later "Annotators with lower numbered priorities are applied first." is incorrect and misleading