LEGO MINDSTORMS Robot Inventor
This design adds on to the Steering Car to make a robot car that will locate and measure a parking space using the distance sensor and then either parallel park into it or back in perpendicular to the space, depending on how long the space is.
Because there is fairly significant play in the steering mechanism in this kind of design, the car has trouble driving straight for anything other than a short distance. To help work around this, this design uses a little steering lock trick to keep the steering straight at the beginning of a run. Make sure the steering lock is engaged (pushed down) before a run. See the programming instructions for more information.
The setup for the autonomous program should be as shown in the "Ready to find the space" photo above. The car should be parallel to the first wall and about 2 inches (5 cm) from it. Try to point the car as straight as possible and be sure to manually straighten the front wheels and then engage the steering locking pin downward to start with, so that the car can drive nice and straight when locating the space. The car will use the fourth motor to automatically pull the locking pin out before turning to park.
The parking space can be adjusted to be long (suitable for parallel parking) or short (for perpendicular backing in). See the Parking Space building instructions for a guide on the recommended sizes.
Due to variability in the distance sensor readings, and slight differences in the robot's initial heading, you will probably get different results each time you try the program, and some runs won't work at all. Real self-parking cars have several more sensors and other tricks to make this work better!