Depends how much money you have.
For example, Tesla just patented the Robotaxi one year ago, despite having open-source solutions like Apollo Self-Driving platform.
Patents are really an obsolete system that favors the super-rich and the lawyers.
I.e. if any algorithm was already implemented, in some variation, then the patent is not valid?
For example, for the infamous Amazon 'one click purchase', if a similar pattern was used, maybe a 'one click start vacuum cleaner robot', would it that patent then be invalid?