adaptive cruise controller module design for the electric vehicle oskar 1 project supervisors:...
TRANSCRIPT
1
Adaptive Cruise Controller Module Design forthe Electric Vehicle OSKAR
Project Supervisors: Assoc. Prof. Dr. Rifat EDİZKAN Asst. Prof. Dr. Ahmet YAZICI
Project Assistant: İslam KILIÇ
Team Members: Mustafa ÖZÇELİKÖRS Atakan ONDOĞAN İbrahim YILDIRIM
Deniz Can DAYAN Metin KUNDAKÇIOĞLU
Material support by;
Eskisehir Osmangazi UniversityElectrical and Electronics Engineering
Engineering Design Senior Project
2
Presentation Outline• Introduction and Motivation• System Overview• Detailed System Design
– Low-Level Infrastructure (RTOS, Sensors & Communication, Motor Drive)• Real Time Operating System• Sensors & Communication
– CAN-BUS Communication– Continental ARS308 Long Range RADAR Sensor Driver + Logging– TCP Communication for Low-Level– Hall-Effect Encoder System
• Motor Drive using DAC– Low-Level Design (Purpose, PID Controllers, PID Tuning, Cohen-coon)– Low-Level Implementation (Throttle-based Control + PID Algorithm)– Low-Level Tests– High-Level Infrastructure (Raspbian system, Rpi, Why Python?)– High-Level Design and Implementation (Purpose, PFM Algorithm, Proposed Radar
Perception Algorithm)– High-Level Display Unit– System Realization with PCB
• Conclusion
3
Introduction & Motivation
What is ACC?
Adaptive Cruise Control (ACC) is an advanced velocity control system for vehicles that automatically adjust the vehicle’s speed in order to maintain a proper distance from vehicles and obstacles on the road.
A vehicle on ACC moves at a pre-adjusted velocity while there is no obstacle or vehicle ahead. If the sensor detects an obstacle or vehicle, the system controls the velocity of the ACC controlled vehicle in order to accelerate, decelerate or stop –according to the speed of the obstacles or cars.
4
WHY ACC ?
Avoid Accidents,Safe DriveBetter driving
comfort (especially on long-distances)
All-domestic carTo gain know-how on the subject of
‘intelligent vehicles’
5
How does ACC system work?
Adaptive Cruise Control (ACC) system uses various sensors (RADAR, LIDAR, GPS, Camera) to detect objects ahead. When an object is detected, sensor sends the information about the target (such as distance, velocity and acceleration) to the controllers.
Controllers take these information and by using the host car’s own velocity, calculate a safe distance and desired velocity values.Then, these values are processed and applied to the vehicle motor in order to track desired velocity and distance values successfully.
6
ACC on Commercial Area:
• In the beginning of the 1990’s, even the CC was a luxury and having the CC feature caused a big price difference to a car.
• By the 2000’s CC has became more and more common and affordable. So does ACC.
• Nowadays, some car manifacturers use ACC system with their own commercial names and different features. These systems vary in:– Number and features of sensors used.– Specialized speed ranges for high performances.– Extra features (such as strip tracking)
7
System Overview
8
System OverviewWhat are needed?
A Cruise State Input:PushbuttonAn actuator: Motor&driverA reference input: Throttle/PedalA feedback sensor:Hall Effect Encoder SystemA vision sensor: ARS-308 Radar SensorAn Engine&Sensor Controller:STM32F4-DISCOVERY withSTM32F4DIS-BBA High-Level Decision Unit:Raspberry PiA visualization & input unit: 3.5” TFT Touchscreen
9
System Overview - ComponentsSTM32F4-DISCOVERYProvides- STM32F407VGT6 168MHz32-bit ARM Cortex-M4F corew/ 1MB Flash 192KB RAM- ADC, DAC, DMA, ETH, USART, CAN, SPI, USB-OTG peripherals that are used in the system.- CMSIS Support: Code is compatible with all the other ARM devices.
STM32F4DIS-BBProvides- Expansion for STM32F4-DISCO- Ethernet, MicroSD that are used in the system.
Raspberry Pi Model B+Provides-700MHz ARM11 Processor- Open VG GPU- 512 MB SDRAM- 40 pin GPIO
4DPi-35 3.5” Touchscreen TFTProvides- 3.5” TFT Display with Touchscreen- Boot-ready kernel for easy interfacing
10
System Overview – Block Diagram
Hig
h Le
vel Low Level
11
Low Level Infrastructure
• Real Time Operating System• Sensors & Communication
– CAN-BUS Communication– Continental ARS308 Long Range
RADAR Sensor Driver + Logging– TCP Communication for Low-
Level– Hall-Effect Encoder System
• Motor Drive using DAC
12
Real Time Operating System
• Real time in embedded systems means that the embedded system must respond to a certain event within a strictly defined time.
• In embedded systems, we often have real-time requirements.
• RTOS provides execution patterns and scheduling while executing real-time tasks.
• It resembles to an operating system.• RTOS has an advanced scheduler that
manages interruption.• FreeRTOS is a highly-known, easy-to-use,
migrateable library for real time operations in embedded systems.
• Configured Priorities, Stack Sizes, Heap Size, Task Creation
• Used Embedded Workbench for ARM
13
Real Time Operating System
• Priorities in the program must be determined delicately to prevent the program from running in the idle task.
• Priorities of the system:PID Routine = Encoder Data Reception > TCP Comm. = ADC Conv. > LEDs&Switches• CAN-BUS is operated with an interrupt routine.• In our system, we defined the task periods with the following fashion,Tasks with Strict Periods > Tasks that require Pending > Other Tasks
Start
Set Priorities, Stack Sizes,Heap Size
Define RTOS Tick Period (1ms in our
system)
Define Task Routines
Start RTOS Scheduler
14
CAN-BUS Communication
• Controller Area Network (CAN) (ISO-11898: 2003) is a 2-wire bus that is used in automotive industry to replace complex wiring harness.
• A transceiver should be used in each node.
• Advantages: High reliability, resistance against electromagnetic interference, real-time capability, multi-speed configurations, high-speed.
• 11-bit and 29-bit Identifier CAN-BUS frames are available. We use 11-bit Identifier.
• CAN Baudrate configuration is crucial. A design equation has been derived.
• CAN-BUS library for STM32 is used.
( 1 2)*Prescaler
ClockFrequencyCANBaudrate
SJW BS BS
ClockFrequency = 42MHz (in the CAN1 line)SJW=1 BS1=6 BS2=7Prescaler = 6CANBaudrate = 500KBps
15
CAN-BUS Communication Implementation
16
Continental ARS-308 Long Range RadarDriver Implementation
• The ARS 308 is a Radar Sensor System developed by Continental for the Automotive Industry to realize advanced driver assistance functions.
• Provides information on targets/objects once configured.
• Provides Motorola big-endian data through CAN-BUS.
17
Continental ARS-308 Long Range RadarDriver Implementation
How to construct actual object data from raw data?
Bitwise OperationsObtained
bit information for each data
Multiply by Resolution
Add the Offset
Obtained actual information of type float/integer/double
#define res1 , res2, ... #define off1, off2, ... _MesajID409H.WarnMsgCounter = (uint8_t) (Data[0]&0x1F); _MesajID409H.RegionID = (uint8_t) ((Data[0]&0xE0)>>5); _MesajID409H.WarningLevel = (uint8_t) (Data[1]&0x03); _MesajID409H.ObjectID = (uint8_t) ((Data[1]&0xFC)>>2); _MesajID409H.ObjLatPos = (uint32_t) ((Data[2]<<2)|((Data[3]&0xC0)>>6)); _MesajID409H.ObjLongSpd = (uint32_t) (((Data[3]&0x3F)<<6)|((Data[4]&0xFC)>>2)); _MesajID409H.ObjLatSpd = (uint32_t) (((Data[4]&0x03)<<6)|((Data[5]&0xFC)>>2));
_ProcessedObject [_MesajID409H.ObjectID].ObjectID = _MesajID409H.ObjectID;_ ProcessedObject [_MesajID409H.ObjectID].ObjLatPos = (_MesajID409H.ObjLatPos)*res1 - off1;_ ProcessedObject [_MesajID409H.ObjectID].ObjLatSpd = (_MesajID409H.ObjLatSpd)*res2 - off2;_ ProcessedObject [_MesajID409H.ObjectID].ObjLongPos = (_MesajID409H.ObjLongPos)*res3;_ ProcessedObject [_MesajID409H.ObjectID].ObjLongSpd = (_MesajID409H.ObjLongSpd)*res4 - off4;_ ProcessedObject [_MesajID409H.ObjectID].ObjWidth = (_MesajID409H.ObjWidth)*res5;
Write data to object
array with index as
Object ID
Object Data (array)
18
Continental ARS-308 Long Range RadarDriver Implementation
Implemented ARS-308 Driver,• Consists of CAN-BUS Transmit and Receive functions.• Consists of CAN-BUS Data Preparation and Clearance functions.• Consists of Raw to Actual Data Resolution functions. (for receiving messages)• Consists of Actual to Raw Data Preparation functions. (for config messages)• Can save all the data to predefined structs.• Has an Object array that is filled with all the information about all the object.• Uses the Object array to apply proposed filter and find the filtered object.
struct Object{ uint8_t ObjectID; uint32_t ObjLatPos; uint32_t ObjLongSpd; uint32_t ObjLatSpd; uint32_t ObjLongPos; uint8_t ObjWidth;};
19
Continental ARS-308 Long Range RadarDriver Implementation
20
Continental ARS-308 Long Range RadarSensor Logging (Raw+Processed Data)
No Mode Mesaj ID(Hex)
RTR DLC D1 D2 D3 D4 D5 D6 D7 D8 Time stamp
1 0 00 00 00 00 00 00 00 00 00
//Determine Object IDiz = _MesajID60BH.Obj_ID;//Write ObjLongPosFloatToStr(_ProcessedObject[iz].ObjLongPos);f_write(&file, STRING_BUF, strlen(STRING_BUF), &bw);f_write(&file, "\t", strlen("\t"), &bw);
• Sensor logging is needed for further understanding of how Radar data works.• We use SD Card for Radar Sensor Logging. (STM32F4DIS-BB)• FatFs library is used for SDIO operations.• A piece of software that can log raw and processed data at the same time to different files has
been created.
21
TCP (Ethernet) Communication• Between Low Level and High Level, TCP Communication is established.• As hardware, STM32F4-DISBB is used, equipped with LAN8720 chip.• Since it is easy to be interfaced in a computer (such as Raspberry Pi) and provides Server-Client
structure, it is selected for the project.• TCP Communication is established with static IP addresses on both server and client. Also, a MAC
address have to be provided.• Highly-known LwIP library (TCP/IP Lib for embedded systems) and Netconn API is used in the
implementation of the TCP Server software.• When sending and receving a data, a struct called pbuf is configured.• XML Design:
<data> <items> <item V_Host=""></item> <item V_CC_Setpoint=""></item> <item Cruise_Button_State=""></item> <item Vehicle_Accel=""></item> <item X=""></item> <item V_Relative=""></item></items></data>
22
Motor Drive Using DAC• OSKAR has a Motor Driver Model D51448.01 of PG Drives Technology.• 2.24V ~ 5V -> Forward incremental• 2.24V ~ 0V -> Backward incremental• Motor Driver 0V~5V , STM32 VDD=3V• An Amplifier is Needed:
(hardware designs are the collective work of all the team members)
23
Motor Drive Using DAC• Throttle Pedal works
within 0.8V~4.2V range. • STM32 has ADC with V_IN
= 3V• A voltage divider is
Needed: (0.57V~3V)
(hardware designs are the collective work of all the team members)
24
Encoder Implementation
25
Low-Level Design
26
Low-Level Design
Two paths for low-level control algortihm design are defined.
Compensating the system with PID controller using both Root-Locus method and PID Tuner tool of MATLAB.
Modeling the system by using a common mathematical model for the motor (24V DC, Brushed).
This study is conducted to get the optimum PID controller parameters for first order process model.
Determining the proportional, integral, and differential parameters in the controller by Cohen-Coon open loop tuning method which is described the controller parameters in the form of formulas or algorithms.
First Path: Second Path:
27End
Modeling the System
Obtaining the Controller’s Gains
Outdoor Tests
Indoor Tests
Determining the Control Method
Start
Are the results
satisfying?
Are the results
satisfying?
No
Yes
Yes
No
28
First Path for Low-Level Design
Model circuitry for a brushed DC motor:
29
Block diagram of the motor’s mathematical model:
Transfer function of the system in Laplace domain:
30
Designing the PID controller for the model with Root-Locus method:
Simulations in MATLAB:Acceptable settling time and percent overshoot values for the step response.
Indoor tests:• Desired performance specifications
could not be satisfied.• Oscillations occured.• Response did not settle.• Extreme percent overshoot value.
31
Designing the PID controller for the model, using PID Tuner tool:
Simulations in MATLAB:Since the purpose of the tuner is to obtain the exact controller gains, simulation resulted in exact success.
Indoor tests:• Desired performance specifications
are mostly satisfied.• Negligible oscillations in steady-
state.• Good performance in high velocity
setpoints.• Relatively high settling time and
percent overshoot for the smaller velocity setpoints
Cohen Coon Method
The Cohen-Coon method is classified as an offline method for tuning, meaning that a step change can be introduced to the input once it is at steady-state. Then by looking at the system’s response, once the values of process parameters are obtained, the PID parameters can be calculated based on Cohen-Coon Tuning Rules.
32
Second Path for Low-Level Design
Cohen-Coon Representative System Output and Input
System Output for OSKAR when the step input was applied
33
The step input is applied to the system until the process
reaches steady state
Obtaining the step graphic of the system
Start
5 parameters (t0, t2, t3, A and B) are
determined by the direct use of graph
Using the measurements of t0, t2, t3, A and B, the process parameters t1, τ, τdel, K and r are calculated by
using MATLAB
System reaches
steady state?
The controller parameters Kc, τ int and τder are obtained by
the implementation of specified formulas of Cohen-
Coon Tuning Rules
Getting the gain constants of PID controller (Kp, Ki
and Kd)
End
No
Yes
34
Determining the PID controller parameters for the model with Cohen-Coon method:
Indoor tests:• Desired performance specifications
could not be satisfied.• Oscillations occured.• Extreme percent overshoot and
settling time values
35
Low-Level Implementation
Kp = 0.1 , Ki = 0.2 , Kd = 0.0047
Formula Discretized Formula
Proportional
Integral
Derivative
P )(teK p )(teK p
I t
i deK0
)(
t
isi ieTK
0
)(
D
dt
tdeKd
)(
sd T
teteK
)1()(
36
Pseudo code of the PID controller:
37
Outdoor Tests
Velocity setpoint is 5 km/h
• Percent overshoot about 40%
• Negligible steady-state error
• Successful settling time• Good performance for
uphill/downhill cases
38
Outdoor Tests
Velocity setpoint is 10 km/h
• Zero overshoot• Steady-state error about
%3• Successful settling time• Best performance for
uphill/downhill cases
39
Outdoor Tests
Comments:• OSKAR’s maximum speed with load
on a plane road is about 15 km/h.• Performance of the control system
works is best at the velocity values around 10 km/h.
• Vehicle’s mechanical limitations affects the system performance.
• Weight of the load is inversely correlated with the performance of the low-level control system.
40
41
High Level Design
Control Methods • Time Delay Control (TDC) • Fuzzy Logic Control• Sliding Mode Control (SMC)• Constant Time Gap Control (CTG)• Proportional Integral (PI) Control • Proportional Derivative (PD) Control• Proportional Integral Derivative (PID) Control• Model Predictive Control (MPC)
ACC can be implemented with various control methods
42
• Conventional Cruise ControlMaintaining a steady speed set by driver
High Level DesignPurpose High Level Unit has two main tasks:
• Adaptive Cruise ControlTwo modes of control: Velocity and DistanceAdjusting velocity in order to maintain a proper distance between vehicles
43
High Level DesignPotential Fields Method (PFM)-Simple version of the Fuzzy Logic Controller-Vehicle is modeled as a particle in space, acted on by some combination of attractive and repulsive fields-Obstacles are modeled as charged surfaces-Net potential generates a desired velocity on the vehicle-Suitable for real-time motion planning of vehicle since the algorithm is simple-Widely used in obstacle avoidance applications for mobile robots, manipulators
44
High Level Implementation
Host vehicle speed, relative speed and distance data measured by Encoder and RADAR sensor is processed with PFM algorithm. Output of the PFM algorithm is the desired speed for the host vehicle.
45
High Level Implementation X_Safe
Minimum safe distance between host and target car
Metre (m)
Th
Constant Time Headway
Second (s)
V_Host
Velocity of the host (follower) car
Velocity (m/s)
d0
Minimum safe interdistance used in X_Safe calculation
Metre (m)
X_Safe_Tolerance
Tolerance distance for X_Safe required to track the vehicle in front
Metre (m)
X
Actual distance between host and target car (Measured from Radar)
Metre (m)
X_Stop
Critical distance to avoid collision
Metre (m)
Acceleration
Deceleration of the host car (Required for X_Sb calculation)
Acceleration (m/s2)
X_Sb
Distance the host car start braking
Metre (m)
V_Target
Velocity of the leading (target) car
Velocity (m/s)
V_Relative
Host car speed according to target car (Relative speed measured from Radar)
Velocity (m/s)
V_CC_Setpoint
The velocity that is adjusted when the ACC is opened (Cruise Control Setpoint velocity)
Velocity (m/s)
V_Desired
Output of the ACC Unit (Desired velocity applied to the host car)
Velocity (m/s)
46
High Level Implementation
47
High Level Implementation
48
High Level ImplementationCase 1: X ≤ X_Stop
Case 2: X > X_Stop and X < (X_Safe - X_Safe_Tolerans)
Case 3: X >= (X_Safe - X_Safe_Tolerans) and X <= (X_Safe + X_Safe_Tolerans)
Case 4: X > (X_Safe + X_Safe_Tolerans) ve X < X_Sb
Case 5: X ≥ X_Sb
(X X _ Safe X _ Safe _ Tolerans)( V _ Host V _ T arg et)V _ Desired V _ T arg et
X _ Sb (X _ Safe X _ Sa
)*(
fe _ Tolerans)
V _ Desired V _ Target
V _ Desired 0
V _ T arg et
X _ SafeV _ Desired X
(X _ Safe _ T X
ol_ St
eraop *
ns
X _ Stop)
V _ Desired V _ CC _Setpoint
49
High Level Simulations and ResultsAccuracy of the code, written in python programming language, is tested in software environment MATLAB
High Level Simulations and ResultsScenario 1: V_Host = 7m/s, V_Target = 3m/s, V_CC_Setpoint = 7m/s, X_Safe = 12m, X_Sb = 26m
Scenario 2: V_Host = 5.5m/s, V_Target = 1m/s, V_CC_Setpoint = 5.5m/s, X_Safe = 10.5m, X_Sb = 25.5625m
51
High Level InfrastructureRaspbian System• Raspbian is a free operating system
based on Debian optimized for the Raspberry Pi hardware
• Debian is Linux based operating system which is set of basic programs and utilities that make Rpi Run
• Provides more than pure Linux OS: Comes with over 35000 packages pre-compiled software bundled, optimized for best performance
52
High Level InfrastructureRaspberry Pi (Rpi)• Credit card sized single board computer• Runs some versions of the Linux OS such as
Debian, Arch Linux ARM, Raspbian, Pidora and also non-Linux distributions as RISC OS.
• Supports Python, C, C++, Java, Perl and Ruby Programming Languages
-700 MHz Low Power ARM11 Processor-Open VG GPU support s Open GL ES 2.0-512 MB SDRAM-Boots from Micro SD card, runs a version of Linux OS-Operates at 5V DC supply-10/100 BaseT Ethernet Socket-HDMI for Video, Jack for Audio outputs-4xUSB 2.0 Connector-40 pin GPIO Connector-Camera Connector, Display Connector
53
High Level InfrastructurePython• Python is a widely used general-
purpose, high-level programming language
• Design philosophy of language emphasizes code readability
• Syntax allows expressing concepts in fewer lines of code than other languages such as C++, Java
• Supports multiple programming paradigms, including object-oriented, imperative and functional programming
• Python shell is used for execution
An instance of Python shell
54
Proposed Radar Perception Algorithm• Recall that the implemented Radar driver is capable of gathering
information of many objects in the environment.• What about roadside objects?
55
• What can a Radar Sensor perceive? A Vehicle
Proposed Radar Perception Algorithm
56
• What about roadside objects? A Vehicle
Proposed Radar Perception Algorithm
57
• How to prevent this?• Answer: We ignore an object if it is out of range of a certain lateral position
A Vehicle
Proposed Radar Perception Algorithm
58
Proposed Radar Perception Algorithm• How do we know which object to act upon?• Overall Conclusion: An object having minimum longtitudunal position and within the lateral position
constraints should be considered.
59
Proposed Radar Perception Algorithm
for (i = 0; i < OBJE_SAYISI; i++) { if (_ObjelerIslenmis[i].ObjLongPos !=0) { //Aracin cok saginda ve cok solundaki objeleri discard et. if (min > _ObjelerIslenmis[i].ObjLongPos) { min = _ObjelerIslenmis[i].ObjLongPos; min_obje_indeksi = i; } } } if(min_obje_indeksi != 0) { if((_ObjelerIslenmis[min_obje_indeksi].ObjLatPos > -1*(ARAC_GENISLIGI/2)) && (_ObjelerIslenmis[min_obje_indeksi].ObjLatPos < (ARAC_GENISLIGI/2))) { //Do nothing } else { min_obje_indeksi = 0; //ObjectIndex=0 ise onde obje yok anlamina gelir } }
60
Display Unit• Display unit hardware: 4DPi-35 3.5” TFT Touchscreen• Display unit software:• Designed by using Adobe Fireworks, Coded with pygame Library for Python• Gets info via TCP Client (XML protocol)• Cruise “+” “-” Touch Buttons to Adjust Cruise Speed• Displays target vehicle distance, speed; host vehicle
speed; cruise status and setpoint speed.
(real photo with simulation variables)
61
PCB Realization of the System
62
PCB Realization of the System
63
Conclusion Until now, literature review about speed control of a DC motor and adaptive cruise control, conventional cruise control and ACC (adaptive cruise control) design, system electronics design, system software implementation has been completed and the completed systems were tested.
In this ongoing project, we intend to use different control algorithm for the development of the high-level controller, retrofit the OSKAR vehicle and make improvements in low level control unit. Also, because of too much circuit in vehicle which causes mess, we are still developed a printed circuit board design.
To sum up, we have built a prototype of Engine Control Unit for an electric vehicle and we defend an opinion that if this system continues to be developed, it will be used among the intelligent vehicle technologies for avoiding the traffic accidents.