Looking for sensor in simulink to sense distance between two vehicles

5 次查看(过去 30 天)
I am trying to find a sensor in the simulink library to detect distance between two vehicles. I am doing my final year project which is a fuzzy logic collision avoidance system. I am trying to model it using matlab and simulink. Can anyone point me in the right direction with respect to where i can find the sensor input in the library? Also i am looking for one to detect the rate of change in velocity of the vehicle in front of the other one.

回答(1 个)

K E
K E 2012-3-27
If you find it easier to code in Simulink, build your distance calculator out of blocks in the Math Operations library. For example, use the Sqrt, Product and Difference blocks to find [2D Distance between Vehicle1 and Vehicle2] = sqrt((x1 - x2)^2 + (y1 - y2)^2), where you are operating on the Cartesian coordinates of vehicle 1 and vehicle 2 (make sure they are in meters not latitude/longitude). You could use the Derivative block to calculate the vector acceleration (rate of change of velocity). If you find it easier to code in Matlab, export the time series of x1, x2, y1, and y1 to the Matlab workspace using the 'ToWorkspace' block and perform the calculation there. Then you could also perform the vector calculation of acceleration.
  2 个评论
Saieed Garcia
Saieed Garcia 2012-3-29
why are you using y coordinates? i have the distances in meters,but that is just for between vehicle 1 and vehicle 2? So
Vehicle 2 <------------> Vehicle 1
(Arrow is distance between that i have the values for.) Rate of change in Velocity i have to calculate. I don't really understand what you said if you could expatiate please, it would be nice, i would greatly appreciate it.)
I am kind of new to MATLAB and simulink, have never really used it.
K E
K E 2012-3-30
I had imagined two vehicles on a road, each with a GPS sensor which measures x and y coordinates. But it sounds like your have two vehicles driving along a straight track. If you have a measurement of the displacement of vehicle 1 and vehicle 2 along the track, then you would double differentiate each vehicle's displacement in time to obtain the rate of change of velocity (i.e. acceleration). If the only available measurement is the distance between the two vehicles, then I am not sure you have enough information to obtain the acceleration of vehicle 1. The closest you might be able to get is the difference in acceleration between vehicle 1 and vehicle 2, which could obtain by writing out the finite difference formula (http://en.wikipedia.org/wiki/Finite_difference) for the second derivative of position of each vehicle, subtracting one from the other, and rearranging to get the difference in acceleration in terms of the distance between vehicle 1 and vehicle 2.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Automated Driving Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by