Project 1 (Mini Project on Vehicle Direction Detection
Mini Project - Vehicle Direction Determination
General Overview:
Identifying the direction of the vehicle is one of the important & diverse features in Autonomous driving & Advanced Driver Assistance Features. This particular sub-feature of identifying the direction of vehicle is basically identifying the direction the vehicle is taking based on the camera input.
Camera reads the road signs & stores into its memory with unique values for left turn, right turn & straight drive. Depending on the direction it is taking, final indication is given to the driver – as an indication if he is driving in the recommended direction or not.
Vehicle Direction Determination can also be coupled along - side features like GPS systems to identify whether the vehicle is reaching its destination in an optimized manner. This sub feature can also be used along with Lane Detection, Highway Warning, Ramp Entry / Exit in Wrong Way Detection etc.
Objective of Mini Project:
- Development of MATLAB Simulink model as per requirement.
- Tag the requirements to the simulink model; tagging requirement 1 & requirement 2 to their corresponding subsystems is fine.
- MBD compliant changes, Data Dictionary creation & code generation is added advantage, and that is not scope of this project.
- If choosing code generation, Storage class for Input signals: ImportedExtern; Storage class for Output signal: Export to File; Storage class for local signals: localizable; Storage class for calibration signals: Const.
- Choose sample time for all signals as 0.01s
Requirement - 1:
- Steering wheel input as yaw rate (Signal name: SteeringWheel_YawDegreeInput) is the input for this system.
- This is compared against 3 angular values, one each for left turn, right turn & straight drive (Calibration Values: Right_Turn_AngularLimit, Left_Turn_AngularLimit, Straight_Drive_Steering_Angle) to say which specific direction the steering wheel is turning towards.
- Use switch blocks to compare & develop this requirement. Keep this requirement in a subsystem & output of this requirement is a local signal (Signal Name: Vehicle_Turn_Status).
Requirement – 2:
- Keep this requirement as a separate subsystem. Inputs to this requirement are local signal from requirement 1 (Signal Name: Vehicle_Turn_Status) & an input signal from camera (Signal Name: CameraInput_RoadSign), which confirms the occurrence of a road sign.
- Signal Vehicle_Turn_Status is compared against calibration values (Calibration Values: RightTurn_RoadSign, LeftTurn_RoadSign, Straight_RoadSign), if each of them is found equal, then each of the three corresponding output is compared against the camera input signal,
- Using a logical operator block, only one among them is finally given as output signal (Signal Name: Vehicle_Direction_Indicator).
Signals & Calibration Data List:
|
Signal / Calibration Name |
Signal Type |
Data Type |
Dimension |
Min |
Max |
Initial Value |
Units |
|
SteeringWheel_YawDegreeInput |
Input |
Int16 |
1 |
-180 |
180 |
- |
Deg |
|
CameraInput_RoadSign |
Input |
Boolean |
1 |
0 |
1 |
- |
- |
|
Vehicle_Turn_Status |
Local |
Int16 |
1 |
-180 |
180 |
- |
Deg |
|
Right_Turn_AngularLimit |
Calibration |
Int16 |
[1 1] |
-180 |
180 |
30 |
Deg |
|
Left_Turn_AngularLimit |
Calibration |
Int16 |
[1 1] |
-180 |
180 |
-120 |
Deg |
|
Straight_Drive_Steering_Angle |
Calibration |
Int16 |
[1 1] |
-180 |
180 |
0 |
Deg |
|
RightTurn_RoadSign |
Calibration |
Int16 |
[1 1] |
-180 |
180 |
30 |
|
|
LeftTurn_RoadSign |
Calibration |
Int16 |
[1 1] |
-180 |
180 |
-120 |
|
|
Straight_RoadSign |
Calibration |
Int16 |
[1 1] |
-180 |
180 |
0 |
|
|
Vehicle_Direction_Indicator |
Output |
Boolean |
1 |
0 |
1 |
- |
- |
Mini Project on Vehicle Direction Detection
Aim :- Main aim or objective of this miniproject is to create a MBD compatiable simulink model for vehicle direction detection as the required specification.
In this project the camera captures and reads the road signs and stores into its memory with values for the left, right turn and straight drive. Depending on the direction it takes the final indication is given to the driver whether he is driving in the recomended direction or not.
Following are the Model Development steps:-
Step 1:- The main model requirement has two major inputs
SteeringWheel_YawDegreeInput and CameraInput_RoadSign entered to the vehicle direction detection and one ouput vehicle_Direction_Indicator

Fig 1:- Main Model
Inside the main model two subsystem 1) Vehicle_Turn_Status_Susbystem 2) Vehicle_Direction_Detection are created as per the requirement.
1) Requirement1 :- Vehicle_Turn_Status_Susbystem
- Steering wheel input as yaw rate (Signal name: SteeringWheel_YawDegreeInput) is the input for this system.
- This is compared against 3 angular values, one each for left turn, right turn & straight drive (Calibration Values: Right_Turn_AngularLimit, Left_Turn_AngularLimit, Straight_Drive_Steering_Angle) to say which specific direction the steering wheel is turning towards.
- Use switch blocks to compare & develop this requirement. Keep this requirement in a subsystem & output of this requirement is a local signal (Signal Name: Vehicle_Turn_Status).
As per the above requiremnt 1 following subsystem has been created

Requirement – 2:
- Keep this requirement as a separate subsystem. Inputs to this requirement are local signal from requirement 1 (Signal Name: Vehicle_Turn_Status) & an input signal from camera (Signal Name: CameraInput_RoadSign), which confirms the occurrence of a road sign.
- Signal Vehicle_Turn_Status is compared against calibration values (Calibration Values: RightTurn_RoadSign, LeftTurn_RoadSign, Straight_RoadSign), if each of them is found equal, then each of the three corresponding output is compared against the camera input signal,
- Using a logical operator block, only one among them is finally given as output signal (Signal Name: Vehicle_Direction_Indicator).
As per the above requiremnt 2 following subsystem has been created

Fig 2:- Requiremnt2 Subsystem
Step 2:- Creating Simulink Data Dictionary file (SLDD)
Go to Mode- click to data dictionary- click new - enter and save sldd file name - browse the sldd file - go to model workspace add and save all the input and ouput signals , parameters in design adata - right click on design data and export to file save in .m format

Fig 3:- Create SLDD

Fig 4:- Adding all Singals and Prameters to the Design data in SLDD
Step 3:- Requirement Tagging
The requiremnts 1 and 2 are tagged to the corresponding subsytem in the simulink model as provided in the requirement word documents
followinng are the steps to tag requirements
1) Highlight requiremnt statement in the word documents
2) Right click on the subsystem in the model which has to be tagged
3) Select "requirements and then
4) 'Link to selection in word'

Fig 5:- Requirement1 Tagging

Fig 6:- Requirement2 Tagging
Step 4:- MAAB guidelines for the Model by Model Advisor
Go to the Anlaysis- then model advisor - click on the check and run the check

Fig 7 :- Model advisor steps to check the model as per MAAB Guidelines

Fig 8:- Final Model Advisor check
Step 5:- Code generation ( Embedded Coder)
Convert the simulink model as a ' C code file' by using the embedded coder convert.
go to model explorer select the coode generation change the target file to ert.tlc and apply and generate the C code file

Fig 9:- C code geneartion

Fig 10 :- Code geneartion report and file
Result :-
The vehicle direction detection has been modelled as per the requirement 1 & 2 given in the challenge .
All the required signals and parameters are defined and loaded in the simulink data dictionaary file .
Model advisor has been run to check errors if any as per the MAAB guidelines.
No errors found in the report.
Code has been generated in the Embedded coder

Fig 11:- Final Output Model
Result :- Final model is created as per the requiremnt data by following all the standard procedure of the model based development and its simulation is run for the sample time of 0.1 sec with the fixed steps of 0.01 secs as given in the requirement
As the simulation display output is (0,0,0)The direction of the vehicle is found to be in the Straight direction
Conclusions :- As the output is Boolean
The Vehicle moves in the staright drive direction if the ouput is (0,0,0)
Vehicle Moves in the Left turn direction if the output is (0,1,0)
Vehicle moves in the Right turn direction if the output is (1,0,0)
Adavance Driver Assistance system(ADAS) consists of various features which makes the vehicle autonomous.
Vehicle direction detection is one of the Key ADAS feature.
Which has been design and developed in the simulimk model as per the given requiremnts
The Miniproject of Vehicle direction detection is completed here and thre resulsts are attachecd.
Thank You