How can I add acceleration variable to my driving scenario matlab code?
3 次查看(过去 30 天)
显示 更早的评论
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.
回答(1 个)
Omik Save
2020-3-18
Since you have position and velocity data, you have two options:
- Do diff(v)/dt where diff take cumulative difference of velocity and dt is the time interval.
- 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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Automated Driving Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!