Monday 28 October 2019

Lego EV3 Guided Car Parking

Here we have implemented Guided EV3 Car Parking. This car is a line follower which is implemented using a light sensor. The car follows the line and reaches the "statues" which indicate that there is an existence of car parking slot in front of them. The slots may be empty or occupied. Car intercepts these statues using an Infra-red sensor. Once the car intercepts a statue, it tries to find if there is a car already parked in front of the statue. Car recognizes this with the help of Ultrasonic sensor. If the parking is already occupied, the car moves on, in search of an empty parking. Once it finds an empty parking, the car parks itself in that parking place.

As you must have noticed, the three statues are erected in the left of the road (the thick black line) and the car parking is on the right of the road. The three statues, correspond to three parking slots. To intercept the statues, the infra-red sensor is mounted on the back-left of the car. While the ultrasonic sensor is mounted on the back-right of the car, to detect whether the parking slot is empty or a car is already parked on the slot. Once an empty car parking slot is detected, the car takes a right turn to park itself. The gyro sensor is mounted on the front-right of the car and helps the car to turn in 90 degrees.  

NOTE: In order to understand the line follower mechanism, it would be good if you read the following article: EV3 Line Follower

Let me explain the program for guided car parking in more detail. The program is implemented in LeJOS programming language. We have a single class called CarkParking. The main method of the program begins with initializing the motors and the sensors. The four sensors, ultrasonic sensor, infrared sensor, color sensor and the gyro sensor are connected to ports S3, S1, S4, S2 respectively. They are initialized in Distance mode, Distance mode, Red mode and Angle mode respectively. The modes of all the sensors are almost self explanatory, except the Red mode of the color sensor. The Red mode returns the intensity of the reflected Red light from the black/white surface. On initializing all the sensors, the line follower program begins and we follow the following algorithm. 

  • Follow the line
    • Check whether the infrared sensor sample is less than 30cm. 
      • If yes, we know that there is a statue present near the car. Then we go ahead and check if ultrasonic sensor sample is greater than 50 cm. 
        • If yes, we know that the car parking is empty. Then we go ahead and check if gyro sensor sample is greater than -90 degrees
          • If yes, we keep taking a right turn until the gyro sensor sample reaches -90 degrees. 
          • If no, continue to follow the line       

Assumption: This program assumes that the automated car is necessarily searching for car parking slot and does not want to continue driving on the road without any need for parking. 




No comments:

Post a Comment