TASK 3. AUTOPARKING

 INTRODUCTION

 

The objective of this practice is to implement the logic that allows an Ackermann car to park in line autonomously. 

In this post I am going to include just solutions with Ackermann car using RADI ROS2 since the difference with the Holonomic car are its movement dynamics; which are easier to work with using Holonomic car.

Along this explanation, I am going to cover the following topics:

  • Parse laser 
  • State 1: Align
  • State 2: Find space 
  • State 3: Move ahead
  • State 4: Turn 
  • State 5: Go back
  • State 6 and 7: Park maneuvers 


PARSE LASER

Throughout the entire exercise, it will be necessary to handle the three lasers in different stages to successfully execute the task assigned to them. Therefore, I have deemed it necessary that within the laser values, if they fall within the minimum and maximum range, they should be stored in a secondary array that includes, at a position, (dist, angle), where "dist" represents the laser distance, and "angle" denotes the angle formed by the laser in that position.

It is important to note that each beam of light from every laser is decomposed into an x and a y component, which will be useful for handling the distances from our targets.

 

Once the laser has been discretized for later use, we can begin working with each defined state.

 

STATE 1: ALIGN

The process of aligning the car has been complex, and after many attempts, I have settled on the following approach: I calculate the deviation and I have created a function that takes the distances from the right laser to obstacles, dividing it into two parts. By taking the difference of the sum of these measures, if the car is turned, I can determine the direction it is facing.

It is not possible to rely solely on the deviation since it increases regardless of the side the car is turned to.

To correct this misalignment, I have chosen a pair of (V, W) to move the car since it is an Ackermann car.

Finally, using a reference threshold for both the dispersion and the difference in the sum of measures, we assume that the car is oriented. To ensure that this measurement is reliable and we can proceed to the next state, I use timestamps to verify that the car remains aligned for 5 seconds.

 

STATE 2: FIND SPACE

At this point, the car is already aligned, and we need to find a free space as it progresses through the environment. To locate this space, I have defined the following:


 

Using the right laser, we define a rectangle with its x and y coordinates (a,b) (determined through trial and error). From there, we can obtain beta, and to find the distances to the objectives, we use the following criterion:


If at any point any of these measures is less than the target, it indicates the presence of an obstacle in the target rectangle.

 

STATE 3: MOVE AHEAD

Once a free space is found, the car moves forward 5 meters.

 

STATE 4: TURN

After going forward 5 meters, the car turns backward by 60 degrees.

 

STATE 5: GO BACK

Once the car has turned, it moves backward until it covers the width of the defined rectangle.

 

STATE 6 & 7: PARK MANEUVERS

Finally, after successfully going back to the desired point, the car remains in operation between states 6 and 7 until the car is aligned.

State 6 involves moving backward while turning to the right until no car is detected using the rear laser. If a car is detected, it transitions to state 7.

State 7 involves moving forward while turning to the right until no car is detected using the front laser. If a car is detected, it transitions to state 6.

 

VIDEOS

  • Park with cars in back and front, initially aligned:


  • Park with cars in back and front, turned left:


  • Park with cars in back and front, turned right:

  • Park with a car in front, initially aligned:  

  • Park with a car in back, initially aligned:


CONCLUSION 

I think this task has been quite interesting and I enjoyed programming it. It has helped me to improve my driving skills.


Comentarios