0
$\begingroup$

If two cars are moving in the same direction. let’s say ego car is in the front and another follower car. the speed, location in x, y coordinates of both cars are given.

How to calculates the distance between the cars in seconds? I have tried the following formula:

time = euclidean distance / (ego speed – follower speed), but something seems not correct.

Can anyone please answer?

$\endgroup$
7
  • $\begingroup$ So what is it that seems incorrect? $\endgroup$ Commented Oct 22, 2019 at 22:23
  • $\begingroup$ I am getting really small values which kept me wondering since my simulation is showing huge distances. $\endgroup$ Commented Oct 22, 2019 at 22:27
  • $\begingroup$ You need to include a time variable in your formula .... the longer the cars have been travelling the greater the distance (and time) between the cars. $\endgroup$ Commented Oct 22, 2019 at 23:09
  • $\begingroup$ Which time are you talking about? A time difference indicates a time period between two events - which two events? When the cars pass each other might be one event (they are at the same location), but what is the second event? Perhaps when they are a set distance apart? $\endgroup$
    – levitopher
    Commented Oct 23, 2019 at 3:15
  • $\begingroup$ @levitopher so basically I want to calculate the gap/distance between the cars in seconds. From the gap in time, I want to make a safety decision. $\endgroup$ Commented Oct 27, 2019 at 16:55

1 Answer 1

0
$\begingroup$

Let $A$ be the first car and $B$ the second (follower). The relative speed between them is $v=v_A-v_B$. If the mean speed is constant, you can use the formula you described $$t=\frac{d}{v}$$ where d is the known distance at a time $t_0$. However, what does this equation tell you? If the cars have the same speed, time will be infinity, that is, $v=0$ and they will never meet. In cases $v_B<v_A$ or $v_B>v_A$ we are calculating the time $B$ will take to reach $A$ by assuming the latter stopped. It does not mean much more than this if you think about it.

Be sure you converted your units (km, seconds, etc...) to the correct ones.

$\endgroup$
1
  • $\begingroup$ Thank you very much. you made the idea clear enough. $\endgroup$ Commented Oct 23, 2019 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.