Challenge

Project 1 (Mini Project on Vehicle Direction Detection

Aim:

>To identify the direction of the vehicle based on the camera input.

Objective:

>Development of MATLAB Simulink model as per requirement.

>Tag the requirements to the simulink model; tagging requiremnet 1 and requirement 2 to the their corressponding subsytems is fine.

>MBD complaint chnages, Data Dictionary creation and code generation is added advantage and that is not scope of this project.

>If choosing code geenration, storage class for input signals: ImportedExtern; storage class for output signal: ExportToFile; storage class for local signals: Localizable; storage class for calibration signals: Const.

>Choose sample time for all the signals as 0.01.

General Overview:

>Vehicle direction examination plays a vital role in several different applications, such application are Driver Assistance System, Electronic Toll collection and Intelligent Parking System.

>Particullary in wrongdoing anticipation and mischange eaxamination this feature can be an added adavtage.

>also as to increase the secutiy level for both the driver and the other vehicle running over the road detection of direction of vehicle is an upperhand to avoid any collision or fatality.

>Identifying the direction of the vehicle is one of the important and diverse features in Autonomous driving and Advanced Driver Assistance Features.

>This particular sub-feature of identifying the direction of vehicle is basically identifying the direction of the vehicle is taking based on the camera input.

>Camera reads the road signs and stores into it's memory with unique values for left turn, right turn and 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 recommanded direction or not.

>Vehicle Direction Determination can also be coupled along-side features like GPS systems to identify weather the vehecle is reaching it's desitination in an optimized manner.

>This sub feature can also be used along with Lane Detection, Highway waning, Ramp Entry/Exit in wrong way detection, etc.

>For this project there were several steps taken which are as follows:

  • Development of the desired model.
  • Configuration parameter setting.
  • Linking of the simulink data dictionary.
  • Requirement Tagging.
  • Signal resolving and signal propagation.
  • Model advisor report generation.
  • C-code generation.

Development Of The Required Model:

>As per the objectives of the project the model has been developed:

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).

>Subsytem is developed by the name of the requirement which contain following elemenst:

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).

>There are two input in this subsystem which are Vehicle_Turn_Status and Camerainput_RoadSign and these were applied to the reletional operator(equal to) and logical AND operator as shown in the above image.

>The output of those AND gate are applied to the Mux and then through the signal conversion block the output of the subsytem is named as Vehicle_Direction_Indicator.

Configuration Parameter Settings:

>Solver Type is changed from variable step to fixed step and solver type is selected as discrete(No continous state) and also sample time is declared as 0.01 second as per the project requirement.

>Also under the code generation option slecting embedded real time as system target file(ert.tlc) under target slection option.

Creation of simulink data dictionary:

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

-

-

>Same has been updated in the design data of veh_dir_det_dd.sldd

>Simulink data dictionary is created with the file name of veh_dir_det_dd and the following simulink signal and parameter are added as per the given requirement.

Requirement Tagging:

>A MS word file is created which contain all the requiremnets and neccassry information to develop the model appropriately.

>The word file is tagged for both the subsytem requiuremnet1 and requirement2 respectively.

>AFter slecting Requirement-2, from above option will take us to the MS word file with requirement-2 highlighted.

>Similarly requirement tagging of the Requirement2 has been done:

Signal Resolving & Signal Tagging:

>All the input signal are resolved at the root level of the model and propogated accordingly as shown below:

>Output signal of Requirement1 is resolved at the root level and then propagated

>Same is done fo the output signal of the Requirement2 also:

Model Advisor Report Generation:

>To generate the report we have to go over the modellig tab and then there at extreme left corner there is a option of Model Advisor and selecting Model Advisor in it.

>It will ask to slect the system for which the report generation is to be taken.

>Then under the by task option unselecting all the previously slected option and then slecting the modelling standard MAB there and in the right box there is option to run slected check and clicking over there will run the slected checks.

>The result of the modelling standard for MAB is as shown below:

Code Generation:

>The code genration is made by going over the APP tab and selecting the EMbedded coder over there.

>Now by clicking over the build option will create the C code as shown.

The C code generated as below:

/*
* File: Mini_Project.c
*
* Code generated for Simulink model 'Mini_Project'.
*
* Model version : 1.1
* Simulink Coder version : 9.3 (R2020a) 18-Nov-2019
* C/C++ source code generated on : Wed Jun 15 21:04:06 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/

#include "Mini_Project.h"
#include "Mini_Project_private.h"

/* Exported data definition */

/* Const memory section */
/* Definition for custom storage class: Const */
const int16_T LeftTurn_RoadSign = -120;/* Referenced by: '<S5>/Constant' */
const int16_T Left_Turn_AngularLimit = -120;/* Referenced by: '<S2>/Constant1' */
const int16_T RightTurn_RoadSign = 30; /* Referenced by: '<S4>/Constant' */
const int16_T Right_Turn_AngularLimit = 30;/* Referenced by: '<S2>/Constant' */
const int16_T Straight_Drive_Steering_Angle = 0;/* Referenced by: '<S2>/Constant2' */
const int16_T Straight_RoadSign = 0; /* Referenced by: '<S6>/Constant' */

/* External inputs (root inport signals with default storage) */
ExtU_Mini_Project_T Mini_Project_U;

/* External outputs (root outports fed by signals with default storage) */
ExtY_Mini_Project_T Mini_Project_Y;

/* Real-time model */
RT_MODEL_Mini_Project_T Mini_Project_M_;
RT_MODEL_Mini_Project_T *const Mini_Project_M = &Mini_Project_M_;

/* Model step function */
void Mini_Project_step(void)
{
int16_T rtb_Vehicle_Turn_Status;

/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant'
* Constant: '<S2>/Constant2'
* Inport: '<Root>/SteeringWheel_YawDegreeInput'
* Switch: '<S2>/Switch1'
*/
if (Mini_Project_U.SteeringWheel_YawDegreeInput > 0.0) {
rtb_Vehicle_Turn_Status = Right_Turn_AngularLimit;
} else if (Mini_Project_U.SteeringWheel_YawDegreeInput > 0.0) {
/* Switch: '<S2>/Switch1' incorporates:
* Constant: '<S2>/Constant1'
*/
rtb_Vehicle_Turn_Status = Left_Turn_AngularLimit;
} else {
rtb_Vehicle_Turn_Status = Straight_Drive_Steering_Angle;
}

/* End of Switch: '<S2>/Switch' */

/* Outport: '<Root>/Vehicle_Direction_Indicator' incorporates:
* Constant: '<S4>/Constant'
* Constant: '<S5>/Constant'
* Constant: '<S6>/Constant'
* Inport: '<Root>/CameraInput_RoarSign'
* Logic: '<S3>/OR'
* Logic: '<S3>/OR1'
* Logic: '<S3>/OR2'
* RelationalOperator: '<S4>/Compare'
* RelationalOperator: '<S5>/Compare'
* RelationalOperator: '<S6>/Compare'
*/
Mini_Project_Y.Vehicle_Direction_Indicator[0] = ((rtb_Vehicle_Turn_Status ==
RightTurn_RoadSign) || Mini_Project_U.CameraInput_RoarSign);
Mini_Project_Y.Vehicle_Direction_Indicator[1] = ((rtb_Vehicle_Turn_Status ==
LeftTurn_RoadSign) || Mini_Project_U.CameraInput_RoarSign);
Mini_Project_Y.Vehicle_Direction_Indicator[2] = ((rtb_Vehicle_Turn_Status ==
Straight_RoadSign) || Mini_Project_U.CameraInput_RoarSign);
}

/* Model initialize function */
void Mini_Project_initialize(void)

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.