Magento2 Programmatically set product images order

I am creating a product programmatically. The problem is that those product images are then displayed in random order in Admin and on storefront. Could someone, please, suggest how to forcingly set their position on product programmatic creation. What I’ve found out so far is Magento\Catalog\Model\Product\Gallery\Processor “updateImage” method, where you can set a position in…