ADAS includes technologies that assist drivers with the safe operation of a vehicle. It uses automated technology, such as sensors and cameras, to detect nearby obstacles or driver errors, and respond accordingly.This project aims to develop the Autonomy with three main layers: Controls, Route Planning & Mapping, and Perception. Thus this system is designed to provide autonomous driving capabilities for vehicles. In this project, we implemented a controller in Python and used it to drive a car autonomously around a track in Carla Simulator. 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 the Lateral Control.
ADAS can enable various levels of autonomous driving. Level 0 – NO Driving Automation. [Cruise Control] Level 1 – Driver Assist. [Adaptive Cruise Control] Level 2 – Partial Driving Automation [Lane Following] The ADAS system follows a modular architecture, with each layer communicating through well-defined interfaces. The high-level architecture is depicted in the following diagram:
The Controls layer is responsible for the linear and lateral movement of the vehicle.
We have implemented a cruise control and adaptive cruise control system using a PID (Proportional-Integral-Derivative) controller for linear control. The PID controller adjusts the vehicle's speed based on the desired speed and the distance to the vehicle in front.
# PID Controller for Linear Control
kp = 0.5 # Proportional gain
ki = 0.1 # Integral gain
kd = 0.2 # Derivative gain
def pid_control(target_speed, current_speed, dt):
error = target_speed - current_speed
integral += error * dt
derivative = (error - previous_error) / dt
control_output = kp * error + ki * integral + kd * derivative
previous_error = error
return control_output
- Setting the car to maintain a constant speed without any human efforts.
- Uses the PID controller for acceleration calculation.
Error v/s Time | Velocity v/s Time |
---|---|
Varies the speed to maintain a safe following distance and stay within speed limits using the PID controller
Error v/s Time | Velocity v/s Time |
---|---|
For lateral control and lane following, we have implemented a pure pursuit controller. This algorithm calculates the steering angle required to follow a desired path or trajectory.
# Pure Pursuit Controller for Lateral Control
def pure_pursuit_control(vehicle_state, waypoints):
look_ahead_distance = 10.0 # Distance to look ahead on the path
closest_point, nearest_distance = get_closest_point_on_path(vehicle_state.position, waypoints)
look_ahead_point = get_look_ahead_point(closest_point, waypoints, look_ahead_distance)
steering_angle = get_steering_angle(vehicle_state, look_ahead_point)
return steering_angle
These controllers have been tested and validated using the Carla simulation environment.
- Tracks and Traces the path from selected waypoints.
- Selects a point from a tunable look-ahead distance and calculates an appropriate steer angle.
- Look-ahead distance depends on the car velocity.
CARLA is an open-source autonomous driving simulator. It was built from scratch to serve as a modular and flexible API to address a range of tasks involved in the problem of autonomous driving, providing a realistic urban environment and high-fidelity physics simulation. We have utilized the Carla Simulator for testing and validation of our ADAS system.
For Installation procedure and detailed operations:
https://hackmd.io/@Shreyas321/B1p-Ha48a/edit
- In the terminal, go to the
Carla_Simulator
folder. - Deactivate the Conda environment:
conda deactivate
- Run the shell file:
./CarlaUE4.sh
- The default Carla window will pop up on the screen.
- Python APIs are used to perform simulations on Carla.
- The
Carla_Simulator/pythonAPI/examples
folder contains example API scripts for better understanding of Carla. - To run an API script, open this folder in the terminal, deactivate the Conda environment, and run the
python name.py
command to execute the required API.
These are the files used to manipulate Carla and perform simulations on it.
WhatsApp.Video.2024-03-28.at.8.09.46.PM.mp4
WhatsApp.Video.2024-04-07.at.11.39.12.PM.mp4
WhatsApp.Video.2024-04-07.at.11.26.14.PM.mp4
Path planning is a fundamental problem in robotics and autonomous systems, involving the determination of a route or path from a start point to a destination while avoiding obstacles and minimizing cost. It is widely used in various applications including robotics, autonomous vehicles, logistics, and gaming.
- The objective is to:
- Ensure the robot or vehicle can navigate safely from the start to the goal.
- Avoid obstacles and dynamic changes in the environment.
- Ensure the vehicle avoids collisions with static and dynamic obstacles.
- Optimize the route for the shortest travel time or distance.
- Adhere to traffic laws and regulations.
- Provide smooth and comfortable routes for passengers.
- Environment Representation: The road network is represented as a graph, where nodes denote intersections and edges represent road segments.
- Collision Detection: Algorithms ensure the planned path avoids collisions using techniques like bounding boxes or voxel grids.
- Cost Function: Factors in travel time, distance, fuel efficiency, and comfort to determine the optimal path.
Implementing Dijkstra's search algorithm on a road network in Berkeley, California using osmnx and networkx library https://osmnx.readthedocs.io/en/stable/ https://networkx.github.io/documentation/stable/