I used to do some work on a guidance system for large ships, it was based on a time of flight laser. So, you shoot a laser off the ship and you time when you sent it. Then if it hits a reflector on the oil platform or wind turbine or other ship, it bounces straight back to you. You time when it arrives back. You can then find out how far the laser light travelled, because you know the speed of light and the time, and distance = speed x time. I did mechanical design for a version of this which span round so that it would find the reflectors on the other platform/turbine/ship up to 1km away.
There’s also a version of this which can’t work as far away, but it doesn’t need reflectors so you can map anything. It’s called LIDAR and it’s what a lot of self driving cars use to look for obstacles.
Basically you have to know where you want to go and where you are now. From that you can calculate how wrong you are and what you need to do to get to where you want to go.
We call this a negative feedback loop where we calculate the difference between what we want and what we have. We then use this answer to work out how much we need to change.
It’s a bit like an air conditioning system where you set the temperature you want and then it measures the current temperature, calculates the difference between the two and works out whether it needs to cool the room or heat it. It keeps doing this several times a minute to match the temperature to the desired one.
You see these negative feedback loops everywhere from self driving cars and drones to fridges.