update loop to detect obstacles earlier