Project 1 (Mini Project on Vehicle Direction Detection
Question 1.
Aim: Identifying the direction of the vehicle based on the camera input.
Objective:
1. Development of MATLAB Simulink model as per requirement.
2. Tag the requirements to the Simulink model; tagging requirement 1 & requirement 2 to their corresponding subsystems is fine.
3. MBD compliant changes, Data Dictionary creation & code generation is added advantage, and that is not the scope of this project.
4. 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.
5. Choose sample time for all signals as 0.01s.
Theory:
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 the vehicle is basically identifying the direction the vehicle is takingbased on the camera input.
The camera reads the road signs & stores them into its memory with unique values for a left turn, right turn & straight drive. Depending on the direction it is taking, the 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 alongside 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
Explaination:
As Per the requriment we have to develope the model for the vehicle Direction Determination.
so for Developing the model first we had done the requriments Analysis.
Requirement - 1:
In this Requriment Steering wheel input as yaw rate (Signal name: SteeringWheel_YawDegreeInput) is the input for this system.
This is compared to 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.
and then 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:
In this requirement we Create 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 compare to 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).
Model of Vehicle Direction Detection :
Subsystem of the main model added with signal convection block :
Subsystem Of Main Model :
As per Requirement -1 the corresponding subsystem is :
The first step in building the model is the understand the requirements and select the right blocks. We will be building a subsystem satisfying the Requirement-1 objectives. We give an input named 'SteeringWheel_YawDegreeInput' which is nothing but the yaw rate of the steering wheel.
This value will be compared with 3 angular values for the left turn, right turn, and straight drive to say which specific direction the steering wheel is turning towards and we use the switch blocks to achieve this. This subsystem is shown below.
we can see that the yaw rate input is compared with the 'Right_Turn_AngularLimit' which is 30. If the input is equal to or greater than 30, then the Right-Turn value will be passed. If not the output of the second switch will be passed. Now, if theinput is less than 30, it passes to the second switch condition, here if the input is not equal to 0, then the Left_Turn value is passed, or else the Straight_Drive value will be passed
As per Requirement -2 the corresponding subsystem is :
We will now build a subsystem satisfying the Requirement-2 objectives. The output of the first subsystem 'Vehicle_Turn_Status' is given input along with the 'CameraInput_RoadSign' to the second subsystem. First, the 'Vehicle_Turn_Status' will be compare with a calibration values RightTurn_RoadSign, LeftTurn_RoadSign, Straight_RoadSign using the 'compare to constant blocks'. The output of each of these comparison values will go through logical operators 'AND' also which will give us the final output called as the Vehicle_Direction_Indicator.
we can see that the input from the previous subsystem will be compared with3 'compare to constant blocks'and the output of which will be compared with the camera input using the logical operators. The AND signal will give us the selected output required and it will be collected using the 'Mux' block. The output can be displayed using the display block.
1. Tagging of the Requirement model :
the requirement are written in the MS-Word which is then tagging with each of the subsystem as shown below.
Requirement 2 Tagging:
2. Creating of SLDD and Linking with the model:
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 |
- |
- |
Link To Data Dictionary :
3. All signals are propagated and resolved:
4. Changes in Configuration parameters for simulation and code generation For Simulation the Solver Setting Change :
For Code Generation, the embedded coder is as target file :
For Code Generation :
After selecting the target model as Embedded Coder, and Click on the build Model option.
Code Generated :
/*
* File: Vehicle_Direction_Indicator.c
*
* Code generated for Simulink model 'Vehicle_Direction_Indicator'.
*
* Model version : 1.7
* Simulink Coder version : 8.9 (R2015b) 13-Aug-2015
* C/C++ source code generated on : Sat Dec 10 16:35:57 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "Vehicle_Direction_Indicator.h"
#include "Vehicle_Direction_Indicator_private.h"
/* External outputs (root outports fed by signals with auto storage) */
ExtY rtY;
/* Real-time model */
RT_MODEL rtM_;
RT_MODEL *const rtM = &rtM_;
/* Model step function */
void Vehicle_Direction_Indicator_step(void)
{
int16_T rtb_Vehicle_Turn_Status;
/* Switch: '<S5>/Switch1' incorporates:
* Constant: '<S7>/Constant'
* Inport: '<Root>/SteeringWheel_YawDegreeInput'
* RelationalOperator: '<S7>/Compare'
*/
if (SteeringWheel_YawDegreeInput == 0) {
/* Switch: '<S5>/Switch' incorporates:
* Constant: '<S5>/Constant'
* Constant: '<S5>/Constant1'
* Constant: '<S6>/Constant'
* RelationalOperator: '<S6>/Compare'
*/
if (SteeringWheel_YawDegreeInput > 0) {
rtb_Vehicle_Turn_Status = Right_Turn_AngularLimit;
} else {
rtb_Vehicle_Turn_Status = Straight_Drive_Steering_Angle;
}
} else {
/* Switch: '<S5>/Switch' incorporates:
* Constant: '<S5>/Constant2'
*/
rtb_Vehicle_Turn_Status = Left_Turn_AngularLimit;
}
/* End of Switch: '<S5>/Switch1' */
/* Outport: '<Root>/Vehicle_Direction_Indicator' incorporates:
* Constant: '<S4>/Constant1'
* Constant: '<S4>/Constant2'
* Constant: '<S4>/Constant3'
* Inport: '<Root>/CameraInput_RoadSign'
* Logic: '<S4>/Logical Operator'
* Logic: '<S4>/Logical Operator1'
* Logic: '<S4>/Logical Operator2'
* RelationalOperator: '<S4>/Relational Operator'
* RelationalOperator: '<S4>/Relational Operator1'
* RelationalOperator: '<S4>/Relational Operator2'
*/
rtY.Vehicle_Direction_Indicator_f[0] = ((rtb_Vehicle_Turn_Status ==
RightTurn_RoadSign) && CameraInput_RoadSign);
rtY.Vehicle_Direction_Indicator_f[1] = ((rtb_Vehicle_Turn_Status ==
LeftTurn_RoadSign) && CameraInput_RoadSign);
rtY.Vehicle_Direction_Indicator_f[2] = ((rtb_Vehicle_Turn_Status ==
Straight_RoadSign) && CameraInput_RoadSign);
}
/* Model initialize function */
void Vehicle_Direction_Indicator_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void Vehicle_Direction_Indicator_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
5. Model Advisor Report :
the model advisor report following the MAAB, go to model advisor select first option and OK it.
Select the modelling standard for MAAB :
Conclusion : Autonomous vehical driving assist the advance feature of vehical hence we create a model. We develpoed model as per MAAB gauidelines and given requirements.
the Model has been Created as per the requirment.
the subsystem are attached with the requriment documents .
SLDD Files is Created as per the Given requuriment.
Model advisor Report is Generated. and also Code is Generated.
















