I am attempting to make a simple Vehicle to Vehicle V2V commutation system using one nRF24L01 as a transmitter and another one for a receiver connected to Arduino Uno. Then I connected 2 GPS devices for each Arduino board type Adafruit Ultimate GPS Breakout Version 3. Is there a mathematical equation or a simple code that can be used to deal with the longitude and latitude obtained from the two devices to know the distance between the two vehicles as well as determine the direction, for example, cars approaching or moving away from depending on the updated values sent from the sender.
I tried to calculate the distance within the coverage area provided by nRF24L01 which provide 500 meters, for example, a straight road with 2 vehicles when the 1st vehicle enter the range of the 2nd vehicle I can get the approximation distances in real time between these vehicles by taking the advantages for the GPS located in both vehicles. Actually I read about different methods but I looking for something simple since I try to apply it in my simple suggested scenario and I successfully transmitted the longitude and latitude of the 2nd vehicle over the nRF24L01 to the 1st vehicle