Making robots work out where they are and where they’re going