Self Driving Cars Longitudinal and Lateral Control Design

Engin Bozkurt

Engin Bozkurt

Istanbul, Istanbul

3 0
  • 0 Collaborators

Self Driving Cars Longitudinal and Lateral Control Design ...learn more

Project status: Published/In Market

Robotics, Artificial Intelligence

Groups
DeepLearning, Artificial Intelligence Europe, Autonomous Driving

Code Samples [1]

Overview / Usage

The waypoints include positions as well as the speed the vehicle should attain. As a result, the waypoints become the reference signal for our controller and navigating to all the waypoints effectively completes the full track.

Since the controller reference contains both position and speed, we need to implement both Longitudinal and Lateral Control.

The output of the controller will be the vehicle throttle, brake and steering angle commands.

The throttle and brake come from the Longitudinal speed control and the steering comes from our Lateral Control.

Methodology / Approach

For longitudinal control, I implemented a PID Controller. This PID controller will take
the desired speed as the reference and outputs throttle and brake. As the desired speeds are reasonably low and steady, I bypass the low-level controller entirely.
PID controller consists of three components. First, a pure gain Kp that
scales the vehicle acceleration based on the speed error. This ensures that the vehicle is
accelerating in the correct direction with the magnitude proportional to the error.
Second, in integral term KI sets up the output based on accumulated past errors.
This ensures the steady steed errors are eliminated for ramp referencing. Finally, the derivative term
KD dampens the overshoot caused by the integration term. To complete the longitudinal control,
we must convert the acceleration output from the PID controller
into throttle and brake commands.
For simplicity, positive outputs will be throttle and negative outputs will correspond to break.

For lateral control, we implement the Stanley controller. Since the reference signal
given are waypoint positions, we need to convert them into cross-track errors and heading errors. I use the current waypoint, and the last waypoint to generate the trajectory line. Then, using the equation of this line, I determine the perpendicular
distance to the front axle. This is our cross track error. We can now convert the cross track
error into part of our steering input by multiplying a gain k. dividing by the current velocity and
taking the inverse tangent. To calculate the heading error we
subtract the current vehicle yard from the trajectory line angle. The trajectory line angle can be
calculated by taking the inverse tangent of its slope.

Adding both the steering derived from the cross track error and the heading error gives us
the total steering input. This completes our lateral controller.

Combining both the longitudinal and lateral controllers gives us the following speed profile and trajectory.

Technologies Used

Carla Simulator

Repository

https://github.com/enginBozkurt/SelfDrivingCarsControlDesign

Comments (0)