How can I add acceleration variable to my driving scenario matlab code?

3 views (last 30 days)
I am writing matlab code of automatic braking system with the help of available driving scenario object functions, to the 'actors' in the driving scenario can we add acceleration along with velocity and position in the code? as I want the ego vehicle to decelerate when it meets the braking distance. please help.

Answers (1)

Omik Save
Omik Save on 18 Mar 2020
Since you have position and velocity data, you have two options:
  1. Do diff(v)/dt where diff take cumulative difference of velocity and dt is the time interval.
  2. Or if there is no true observation of acceleration in your model, use a Kalman filter (https://www.mathworks.com/help/control/ref/kalman.html) with the following parameters:
A = [1 T T^2/2;0 1 T;0 0 1]; %States (Position, velocity, acceleration)
G = [T^3/6;T^2/2;T];
C = [1 1 0]; %Output
there is no u (input) hence B is considered 0. Use initial states as
Once you have this, tune Q,R,N and H based on your results of acceleration. One good way to tune is by matching the ouput of Kalman filter with the acceleration mentioned in method 1.

Community Treasure Hunt

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

Start Hunting!