Challenge

Project 1 (Mini Project on Vehicle Direction Detection

Mini Project - Vehicle Direction Determination

Objective of Mini Project:

  1. Development of MATLAB Simulink model as per requirement.
  2. 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).
Proces
Here we create two subsystem for the two requirements.
SLDD is made of the data provided. Ans assigned to the constant block.
The requrement is then coupled into a system and the model is made to run.
Simulink Model:
Requriment 1
Requirenment 2:
Blocks Used:
  1. Constant
  2. Equal too
  3. input
  4. Output
  5. Logical Operation
  6. Switch
  7. Display
  8. MuX

Final Model.

The requirenment 1&2 is converted into a single subsystem.

Result.

The sign of the vehicle direction is in Boolean expression with, first ight follew by left and straight respectively.

If the result turns out to be (1,0,0) , means vehicle takes right turn

After Running the simulink model:

Conclusion As we achived the result as (0,0,1) the vehicle is moving in straight direction.

Settings to be Changed.

Code for the sub-system.
*
* File: Subsystem.c
*
* Code generated for Simulink model 'Subsystem'.
*
* Model version : 1.3
* Simulink Coder version : 9.7 (R2022a) 13-Nov-2021
* C/C++ source code generated on : Mon Jun 27 00:04:31 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives:
* 1. Execution efficiency
* 2. RAM efficiency
* Validation result: Not run
*/
#include "Subsystem.h"
#include "rtwtypes.h"
/* Exported data definition */
/* Const memory section */
/* Definition for custom storage class: Const */
const int16_T Left_Turn_AngularLimit = -120;/* Referenced by: '<S2>/Constant1' */
const int16_T Right_Turn_AngularLimit = 30;/* Referenced by: '<S2>/Constant3' */
const int16_T Straight_roadsign = 0; /* Referenced by:
* '<S2>/Constant2'
* '<S3>/Constant2'
*/
const int16_T left_RoadSign = -120; /* Referenced by: '<S3>/Constant1' */
const int16_T right_RoadSign = 30; /* Referenced by: '<S3>/Constant' */
/* RightTurn_RoadSign */
/* External inputs (root inport signals with default storage) */
ExtU rtU;
/* External outputs (root outports fed by signals with default storage) */
ExtY rtY;
/* Model step function */
void Subsystem_step(void)
{
int16_T rtb_Switch;
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant2'
* Constant: '<S2>/Constant3'
* Inport: '<Root>/Streeingwheel_yanwheel_input'
* Switch: '<S2>/Switch1'
*/
if (rtU.Streeingwheel_yanwheel_input >= 30.0) {
rtb_Switch = Right_Turn_AngularLimit;
} else if (rtU.Streeingwheel_yanwheel_input != 0.0) {
/* Switch: '<S2>/Switch1' incorporates:
* Constant: '<S2>/Constant1'
*/
rtb_Switch = Left_Turn_AngularLimit;
} else {
rtb_Switch = Straight_roadsign;
}
/* End of Switch: '<S2>/Switch' */
/* Outport: '<Root>/Vehicle_direction_indicator' incorporates:
* Constant: '<S3>/Constant'
* Constant: '<S3>/Constant1'
* Constant: '<S3>/Constant2'
* Inport: '<Root>/Camerainput_roarsign'
* Logic: '<S3>/Logical Operator'
* Logic: '<S3>/Logical Operator1'
* Logic: '<S3>/Logical Operator2'
* RelationalOperator: '<S3>/Equal'
* RelationalOperator: '<S3>/Equal1'
* RelationalOperator: '<S3>/Equal2'
*/
rtY.Vehicle_direction_indicator[0] = ((rtb_Switch == left_RoadSign) ||
rtU.Camerainput_roarsign);
rtY.Vehicle_direction_indicator[1] = ((rtb_Switch == right_RoadSign) ||
rtU.Camerainput_roarsign);
rtY.Vehicle_direction_indicator[2] = ((rtb_Switch == Straight_roadsign) ||
rtU.Camerainput_roarsign);
}
/* Model initialize function */
void Subsystem_initialize(void)
{
/* (no initialization code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/
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.