Challenge

Project 1 (Mini Project on Vehicle Direction Detection

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.

Ans-

We have to create a model which suits the given requirements,We have the main model,

In 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, that is for 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.Using 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).

The steering wheel yaw angle is compared with the help of the switch block with left tur,right turn and straight drive steering angle if it matches the condition in the switch block it will pass the signal to the next subsystem,

In Requirement 2

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 OR operator block, Using mux block the output from the operator is given and given to a display,Vehicle_Direction_Indicator is the output represented by the display.

Next From the modelling pallete we have to link the dictionary to the model,we have to create a sldd file for initiliazing the given datas,So creating a sldd file and entering the values given above,

We are creating a sldd file p1 in the location where we save our model,

For right turn,

the output will be,

For left turn,

the output will be,

For straight direction ,

the output will be,

We can see from the table if the vehicle is taking a left turn ,the angle will be negative value and for a right turn the steering angle will acquire a positive angle,and the third condition is in straight direction where it will providing with a zero yaw angle.

In the model configuration parameter table we can change the solver settings to given values,the sample time is changed to 0.1 seconds for the model

Generation of code for the model,From the apps icon we have the option to buld and generate the model,

/*
 * File: Subsystem.c
 *
 * Code generated for Simulink model 'Subsystem'.
 *
 * Model version                  : 1.1
 * Simulink Coder version         : 9.5 (R2021a) 14-Nov-2020
 * C/C++ source code generated on : Mon Nov 29 22:36:40 2021
 *
 * 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"

/* External inputs (root inport signals with default storage) */
ExtU rtU;

/* External outputs (root outports fed by signals with default storage) */
ExtY rtY;

/* Real-time model */
static RT_MODEL rtM_;
RT_MODEL *const rtM = &rtM_;

/* Model step function */
void Subsystem_step(void)
{
  int32_T rtb_Switch;

  /* Switch: '<S2>/Switch' incorporates:
   *  Constant: '<S2>/Constant'
   *  Constant: '<S2>/Constant2'
   *  Inport: '<Root>/SteeringWheel_YawDegreeInput'
   *  Switch: '<S2>/Switch1'
   */
  if (rtU.SteeringWheel_YawDegreeInput >= 30.0) {
    rtb_Switch = 30;
  } else if (rtU.SteeringWheel_YawDegreeInput != 0.0) {
    /* Switch: '<S2>/Switch1' incorporates:
     *  Constant: '<S2>/Constant1'
     */
    rtb_Switch = -120;
  } else {
    rtb_Switch = 120;
  }

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

  /* Outport: '<Root>/Vehicle_Direction_Indicator' incorporates:
   *  Constant: '<S3>/Constant'
   *  Constant: '<S3>/Constant1'
   *  Inport: '<Root>/CameraInput_RoadSign'
   *  Logic: '<S3>/Logical Operator1'
   *  Logic: '<S3>/Logical Operator2'
   *  Logic: '<S3>/Logical Operator3'
   *  RelationalOperator: '<S3>/Equal'
   *  RelationalOperator: '<S3>/Equal1'
   *  RelationalOperator: '<S3>/Equal2'
   */
  rtY.Vehicle_Direction_Indicator[0] = ((30 == rtb_Switch) ||
    rtU.CameraInput_RoadSign);
  rtY.Vehicle_Direction_Indicator[1] = ((-120 == rtb_Switch) ||
    rtU.CameraInput_RoadSign);
  rtY.Vehicle_Direction_Indicator[2] = ((0 == rtb_Switch) ||
    rtU.CameraInput_RoadSign);
}

/* Model initialize function */
void Subsystem_initialize(void)
{
  /* (no initialization code required) */
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */

Thus the code is generated for the model.

Conclusion-

The required adas model is created using simulink with the given configurations.

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.