We are assigned to design and implement an adaptive cruise control system in Simulink. In the manual mode, we will be able to use the haptic wheel to drive the car in simulation and use the potentiometer to control the speed. In the speed or velocity mode, the car would be able to keep a safe distance from the car in front of it and drive on a constant speed if there is no car in front of it. In the auto steering mode, we no longer need to use haptic wheel to control the car. We implement a PID control system to always keep the car in the middle of the lane. We break down the entire project into three tasks. In the first task, we will be able to use the haptical wheel as the steering wheel to control the direction of car. In the second task, we will be able to implement adaptive cruise control to make sure the car will automatically adjust position and velocity if there are other cars in front of it. Finally, we will be able to achieve the automatic steering, where the car will adjust itself to always keep driving at the middle of the lane.
Pick Lead Logic
If there is no car driving in front of us, then our car will be the lead car. Otherwise, of all cars that is in front of us, we would pick the one that is the closest to us.
Automatic Steering Controllers
We first created the PD controller with Kd = 0.05,and Kp = 0.5. It was suggested that the Kd value lie between 0 and 0.1, so we chose a middle value to start with. We used the same methodology for choosing Kp, only with a suggested value between 0 and 1. Our PD controller was outputting the desired delta based on the position, n, in the lane, with n = 0 being the centerline. For example, if n > 1, the desired delta would represent a need to turn the wheel left. To test the effectiveness of our K values in the PD controller, we modified our system to use the output of the PD controller as the input to vehicle dynamics instead of the received delta value from CAN. By using delta desired instead of the actual delta, we were able to fine-tune our system to drive perfectly down the center lane (however unsafe this may be). After trying several values above and below the initial choices, we agreed that our starting values were sufficient, so our system had Kd = 0.05 and Kp = 0.5.
Next, we reconnected the received delta to the vehicle dynamics to ensure the vehicle would operate properly when automatic steering was disabled. We then created the PID controller with arbitrary initial values of Kd = 50, Ki = 0.01 and Kp = 400, based on a suggested range with input of the delta offset between the received delta and the desired delta from the PD controller. The PID controller then output the automatic torque associated with the corrective steering needed to maintain a course on the centerline. This value was then added to the self-aligning torque if automatic steering control was enabled. We found that the chosen starting values caused frequent over-correction and resulted in oscillating around the centerline. After a process of trial and error, modifying each K value independently, we found that Kp was the value in charge of correction amplitude. We had several problems during the trial and error process that will be discussed in the encountered problems section. We finally settled on on K values of Kd=50, Ki = 0, and Kp = 550 which allowed the automatic steering to work sufficiently.
We had a problem where the car starts to lose control when the speed exceeds 25 mph. We solved it by dividing the haptic wheel angle input by 10 so that the read in steering angle will be smaller to make the system more stable.
When we tried to implement the auto steering control, the haptic wheel became unstable once we start the program. After making sure we have the correct sign for each input, we changed the Ki value from 0.01 to 0 and that solved the problem.
Another problem we met is in implementing the adaptive cruise control. The system would be either in complete manual mode or complete adaptive cruise control mode. Then we figured out that the dip switch input is not properly read. We changed into a different dip switch and then solved the problem.