I am unable to find how to fix the error for the message 'Inferred size ('[7]') for data 'yOut' does not match specified size ('[3]')' for my PID controller problem

3 views (last 30 days)
Hello, I am a masters student trying to make an autonomous steering algorithm on MATLAB Simulink. My aim is to use a simple PID controller to test the steering accuracy for a simulated vehicle. Below is the simulink model for the PID:
The aim of this PID controller is to take in the reference path generated as the input, and use back propagation to calculate the error in the current path. This error feeds into the discrete PID controller, which then outputs to the discrete transfer function. Then finally, the data is given to the Vehicle Body Wheel Angle Front, to determine the change in wheel angle to reduce the error. From this, I would be able to plot the steering angle graph and have a 2D visualisation of the path tracking. However I am faced with a number of problems such as:
The first error, I sort of understand, the output is generating [7] size data but it only accepts [3], but I don't know how to fix this problem. I have tried to manually change the accepted size however the Vehicle Body is locked from making any changes. I do understand that an input size of 1 is required for WhlAngF but it is recieving 3, however I don't know any way of making it so that the ref path and current path combine to form a 1D vector with 1 element.
If anyone could help in suggesting possible actions to take or a specific block that could be useful, please do let me know as this is quite urgent.
Thank you very much for your time,
Lamim
  2 Comments
Oguz Kaan Hancioglu
Oguz Kaan Hancioglu on 30 Mar 2023
Hi
The vehicle requires one input but the PID output is 3. Either you decrease the dimension of the PID controller or you increase the input of the vehicle model. the referance of the controller is the state of the system. The states of the vehicle is 3. If you want to control just only heading, you can only send heading state of the vehicle state to the integrator in the reference data section.
I hope it will solve your problem.
Best

Sign in to comment.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 30 Mar 2023
You have to straighout your design first. The reference has three elements, thus the feedback, the error and the PID controller input and output, all have three elements. What are the three control command that you can apply, since the PID controller output has three elements?
Most likely, you have only one control variable, the steering angle. So you have to take whatever info available, do whatever control design (or just a PID controller with one input) to come up with that steering angle command.
Please note, that the 3DOF dual tracks model does expect two steering angle inputs (left and right). In most cases, it is done by duplicating the single steering angle command to both left and right.
  3 Comments
Fangjun Jiang
Fangjun Jiang on 30 Mar 2023
Most likely, the PID controller plus the transfer function plus the delay, have caused the instability of the whole system. You can still log data with this 10 second simulation to see if the steering angle command is reasonable.
An immediately work-around, you can reduce the constant speed from 9 to a small number, you may be able to run the simulation a little longer but it doesn't solve your controller instability problem.

Sign in to comment.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!