Project 1 (Mini Project on Vehicle Direction Detection
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.(compared to constant)
- 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)




configuaration settings

vehicle_directionweek11.c
/*
* File: vehicle_directionweek11.c
*
* Code generated for Simulink model 'vehicle_directionweek11'.
*
* Model version : 1.3
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Sun Apr 17 22:57:09 2022
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "vehicle_directionweek11.h"
#include "vehicle_directionweek11_private.h"
/* Exported data definition */
/* Definition for custom storage class: ExportToFile */
boolean_T vehicle_direction[3]; /* '<S2>/Signal Conversion' */
/* Const memory section */
/* Definition for custom storage class: Const */
const int16_T left_road = -120; /* Referenced by: '<S2>/Constant1' */
const int16_T left_turn = -120; /* Referenced by:
* '<S3>/Constant2'
* '<S3>/Constant5'
*/
const int16_T right_road = 30; /* Referenced by: '<S2>/Constant' */
const int16_T right_turn_limit = 30; /* Referenced by:
* '<S3>/Constant1'
* '<S3>/Constant4'
*/
const int16_T straight = 0; /* Referenced by: '<S2>/Constant2' */
const int16_T straight_drive = 0; /* Referenced by:
* '<S3>/Constant6'
* '<S3>/Constant7'
*/
/* Real-time model */
static RT_MODEL_vehicle_directionwee_T vehicle_directionweek11_M_;
RT_MODEL_vehicle_directionwee_T *const vehicle_directionweek11_M =
&vehicle_directionweek11_M_;
/* Model step function */
void vehicle_directionweek11_step(void)
{
/* local block i/o variables */
int16_T vehicle_turn;
/* Switch: '<S3>/Switch' incorporates:
* Constant: '<S3>/Constant4'
* Constant: '<S3>/Constant5'
* Constant: '<S3>/Constant6'
* Inport: '<Root>/yaw_degree'
* RelationalOperator: '<S3>/Relational Operator'
* RelationalOperator: '<S3>/Relational Operator1'
* RelationalOperator: '<S3>/Relational Operator2'
* Switch: '<S3>/Switch1'
* Switch: '<S3>/Switch2'
*/
if (yaw_degree == right_turn_limit) {
/* Switch: '<S3>/Switch' incorporates:
* Constant: '<S3>/Constant1'
*/
vehicle_turn = right_turn_limit;
} else if (yaw_degree == left_turn) {
/* Switch: '<S3>/Switch1' incorporates:
* Constant: '<S3>/Constant2'
* Switch: '<S3>/Switch'
*/
vehicle_turn = left_turn;
} else if (yaw_degree == straight_drive) {
/* Switch: '<S3>/Switch2' incorporates:
* Constant: '<S3>/Constant7'
* Switch: '<S3>/Switch'
* Switch: '<S3>/Switch1'
*/
vehicle_turn = straight_drive;
} else {
/* Switch: '<S3>/Switch' incorporates:
* Constant: '<S3>/default'
* Switch: '<S3>/Switch1'
* Switch: '<S3>/Switch2'
*/
vehicle_turn = 0;
}
/* End of Switch: '<S3>/Switch' */
/* SignalConversion: '<S2>/Signal Conversion' incorporates:
* Constant: '<S2>/Constant'
* Constant: '<S2>/Constant1'
* Constant: '<S2>/Constant2'
* Inport: '<Root>/camera_input'
* Logic: '<S2>/AND'
* Logic: '<S2>/AND1'
* Logic: '<S2>/AND2'
* RelationalOperator: '<S2>/Relational Operator'
* RelationalOperator: '<S2>/Relational Operator1'
* RelationalOperator: '<S2>/Relational Operator2'
*/
vehicle_direction[0] = (camera_input && (vehicle_turn == right_road));
vehicle_direction[1] = (camera_input && (vehicle_turn == left_road));
vehicle_direction[2] = (camera_input && (vehicle_turn == straight));
}
/* Model initialize function */
void vehicle_directionweek11_initialize(void)
{
/* (no initialization code required) */
}
/* Model terminate function */
void vehicle_directionweek11_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for generated code.
*
* [EOF]
*/

the output results in default state.