Thank you getting in contact with us.
Is the value of the ultrasonic distance sensor erratic or does it just drop to zero when the motors are running? You could try running the motors at a lower speed % or, if you haven’t already, try connecting the distance sensor’s power directly to the batteries.
If you do suffer from erratic values, you can try averaging them out – so take 10 samples a second, add them up and then divide the result by 10. You could then adapt this depending on how sensitive you need it to be.
I hope this answers your question. Any more problems, please don’t hesitate to ask.