# Calculating Speed Between Two Cars

• kacem
In summary: Can you clarify?Theta is the movement direction relative to the chase car based on : theta = atan2(Vyi,Vxi) Vx and Vy are the speeds of the ego vehicle and the ground object, respectively.In summary, the program calculates the speed of two cars by estimating the speed of the lead car with radar and then applying the atan2 function to calculate the heading angle and lateral ground speed.
kacem
Hi,
I found a programming problem that calculated the speed between two cars as below and I would like to know how the calculation is done.
it is about determining the speed of two cars. The coordinate reference system (y,x) is attached to the ego vehicle (as shown in the attached figure).
The speed of the lead car is estimated with the radar of the ego vehicle.
As mentioned in the program reference: The true ground speed of a radar-reported object from the relative speed and the ego vehicle speed is calculated as follows:
(Vxi,Vyi) : relative object speed
egoSpeed : ego vehicle speed
[Vx,Vy] : ground object speed

Vx = Vxi + egoSpeed :Calculate longitudinal ground speed
theta = atan2(Vyi,Vxi) :Calculate heading angle
Vy = Vx * tan(theta) :Calculate lateral ground speed

Is there anyone who can explain how Vx and Vy are calculated? and why he uses the term "ground"?
Thank you.

#### Attachments

• prob.png
2.7 KB · Views: 152
Welcome to the PF.
kacem said:
Is there anyone who can explain how Vx and Vy are calculated? and why he uses the term "ground"?
Those equations are just showing the vector addition of the two vehicle speeds to get the speed of the front vehicle with respect to the ground.

Have you learned any vector math in your schoolwork so far? If not, we can probably suggest some learning resources to help you get up to speed on these kinds of questions.

kacem said:
I found a programming problem ...
Where is the code from? It seems wrong:
Theta is the movement direction relative to the chase car based on : theta = atan2(Vyi,Vxi)
But it is used to relate the velocity components relative to ground : Vy = Vx * tan(theta)

## 1. How do you calculate the speed between two cars?

To calculate the speed between two cars, you will need to measure the distance between the two cars and the time it takes for one car to reach the other. Then, divide the distance by the time to get the average speed in meters per second (m/s).

## 2. What units should be used to measure the distance and time?

The distance should be measured in meters (m) and the time should be measured in seconds (s) for accurate calculations of speed.

## 3. Can the speed between two cars be calculated if the cars are moving at different speeds?

Yes, the speed between two cars can still be calculated if the cars are moving at different speeds. However, the calculation will result in an average speed between the two cars, rather than the individual speeds of each car.

## 4. How accurate are the calculations of speed between two cars?

The accuracy of the calculations will depend on the accuracy of the measurements taken for distance and time. The more precise the measurements, the more accurate the calculated speed will be.

## 5. Are there any other factors that can affect the speed between two cars?

Yes, there are other factors that can affect the speed between two cars, such as the road conditions, traffic, and weather. These factors can impact the distance and time measurements, resulting in a slightly different calculated speed.

• Mechanics
Replies
20
Views
3K
• Introductory Physics Homework Help
Replies
4
Views
1K
• Mechanics
Replies
6
Views
1K
• Special and General Relativity
Replies
23
Views
1K
• Mechanical Engineering
Replies
20
Views
2K
• Mechanics
Replies
7
Views
10K
• Introductory Physics Homework Help
Replies
30
Views
2K
• Special and General Relativity
Replies
13
Views
2K
• Special and General Relativity
Replies
57
Views
4K
• Introductory Physics Homework Help
Replies
5
Views
1K