HackerShackOfficial / Autonomous-Follow-Me-Cooler

Cooler that follows you by navigating via GPS 🍹🌊⛱
89 stars 61 forks source link

geoBearing function explanation #2

Open Christiandd opened 6 years ago

Christiandd commented 6 years ago

Hi, I'm sorry for the improper use of the "issues" page but I didn't find a way to contact you! I would some explanation concerning the "geoBearing" function because I'm doing a similar project but with two Android (one on arduino and one phone, connected via ESP8266 to Arduino), but I don't understand the calculation that you have done in this function: I mean, I haven't understand why is not as I written in my code , without sin and cos :

  float y = latPhone - latArd;
  float x = lonPhone - lonArd;
  dirPhone = 2 * atan( y / ( sqrt(x * x + y * y) + x)); //gived in Radians
  dirPhone = dirPhone * 180 / M_PI;  //radians to grade

I haven't tested it in an open space, but if you can explain to me why it is wrong to not considerate sin and cos, it would be great! Thanks in advance!