Vehicle Direction Detection
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.
- MBD compliant changes, Data Dictionary creation & code generation.
- Choose sample time for all signals as 0.01s
Introduction:
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.
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).
The overall model is :

there are two subsystems have been created to process the above mentioned requirements:

Requirement 1: turnstatus

the value to the right turn have declared with

Requirement 2: Vehicle Direction Indicator

now , after building the subsystems corresponding requirements tagging to the word is done for future reference purpose:


similarly the requirement 2 also done:

after finishing the modelling setup and tagging , linking of signals,parameters are necessary so likewise data dictionary have been created

as sucessfully creating data dictionary the signals inside the model has to be propagated and invoked using the data dictionary .

as it can be seen in the above block "signal name must resolve in simulink object " is ticked .
before the code generation and model report checks we have to configure the parameters of matlab to get optimum results

the solver time is set to 0.01s with Fixed step discrete (no continous states).
later the settings have been adjusted as listed with optimum warnings and errors.
for the code generation point the option should to be kept to embedded coder with ert.tlc

and for coverage analysis either we can do by selecting withing configuration parameters options or using the App named "model advisor".

with the low amount of warnings that can be tolrated while code generation, the model report coverage analysis.
Results ,Simulation and Analysis:
Left turn:
change the parametre of the streering wheel_yawDegreeinput to -120 degree to obtain the turn of turn 

where by the left turn output have been obtained .
similarly the right turn and straight drive can done .
Right turn :

Straight drive:

there fore all the three directions detections are accomplished.
Code Generation:

after eradictcating errors , and reducing warning as per the MAAB ,JMAB and Misra C guidelines we can move further to code generation part using embedded coder and click "Build".
Program :