I designing a bipedal robot, but I want it the be able to walk off and onto a kerbside properly. So my idea is to put something on the bottom of it's feet of which will measure it's distance to the floor. That way, my robot will know if the ground level has inclined or declined and adjust accordingly. But please can I have a real description of how I could do it. Obviously I've looked up sonar, but I'm not really sure how I would build such system. I'm open to any idea as long as it would work. Thank you!