Challenge

Project 1 (Mini Project on Vehicle Direction Detection

The image below is the snip of the overall subsystem.

As it shows two inputs steeringwheel_yawdegreeinput and Camerainput_Roadsign.

Inside it the two requirements are shown the first input is for requirement1 and second input is for requirement2.

Our overall output is Vehicle_Direction_Indicator.

The subsystem of requirement 1 is shown below.

As the input 1 comes the folllowing logic is applied.

According the initial values that are provided

The image below is requirement 2 model block.

Again the initial values are provided for the roadsign blocks.

Given below is the c code for the compleate model.
/*
* File: miniproject.c
*
* Code generated for Simulink model 'miniproject'.
*
* Model version : 1.0
* Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
* C/C++ source code generated on : Wed Feb 9 18:28:35 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 "miniproject.h"
/* Exported data definition */
/* Definition for custom storage class: ExportToFile */
boolean_T Vehicle_Direction_Indicator[3];/* '<S3>/Signal Conversion' */
int16_T Vehicle_Turn_Status; /* '<S2>/Switch' */
/* Model step function */
void miniproject_step(void)
{
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant'
* Constant: '<S2>/Constant1'
* Constant: '<S2>/Constant2'
* Inport: '<Root>/SteeringWheel_YawDegreeInput'
* RelationalOperator: '<S2>/Relational Operator'
* RelationalOperator: '<S2>/Relational Operator1'
* RelationalOperator: '<S2>/Relational Operator2'
* Switch: '<S2>/Switch1'
* Switch: '<S2>/Switch2'
*/
if (SteeringWheel_YawDegreeInput == Right_Turn_AngularLimit) {
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant3'
*/
Vehicle_Turn_Status = Right_Turn_AngularLimit;
} else if (SteeringWheel_YawDegreeInput == Left_Turn_AngularLimit) {
/* Switch: '<S2>/Switch1' incorporates:
* Constant: '<S2>/Constant4'
* Switch: '<S2>/Switch'
*/
Vehicle_Turn_Status = Left_Turn_AngularLimit;
} else if (SteeringWheel_YawDegreeInput == Straight_Drive_Steering_Angle) {
/* Switch: '<S2>/Switch2' incorporates:
* Constant: '<S2>/Constant5'
* Switch: '<S2>/Switch'
* Switch: '<S2>/Switch1'
*/
Vehicle_Turn_Status = Straight_Drive_Steering_Angle;
} else {
/* Switch: '<S2>/Switch' incorporates:
* Constant: '<S2>/Constant6'
* Switch: '<S2>/Switch1'
* Switch: '<S2>/Switch2'
*/
Vehicle_Turn_Status = 0;
}
/* End of Switch: '<S2>/Switch' */
/* SignalConversion: '<S3>/Signal Conversion' incorporates:
* Constant: '<S3>/Constant'
* Constant: '<S3>/Constant1'
* Constant: '<S3>/Constant2'
* Inport: '<Root>/CameraInput_RoadSign'
* Logic: '<S3>/AND'
* Logic: '<S3>/AND1'
* Logic: '<S3>/AND2'
* RelationalOperator: '<S3>/Relational Operator'
* RelationalOperator: '<S3>/Relational Operator1'
* RelationalOperator: '<S3>/Relational Operator2'
*/
Vehicle_Direction_Indicator[0] = (CameraInput_RoadSign && (Vehicle_Turn_Status
== RightTurn_RoadSign));
Vehicle_Direction_Indicator[1] = (CameraInput_RoadSign && (Vehicle_Turn_Status
== LeftTurn_RoadSign));
Vehicle_Direction_Indicator[2] = (CameraInput_RoadSign && (Vehicle_Turn_Status
== Straight_RoadSign));
}
/* Model initialize function */
void miniproject_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.