0

I'm building an autonomous quad copter I'm trying to move the quad to a target GPS co-ordinate, I'm calculating the distance of the target using haversine formula, and now I want to calculate the heading.

For example, I want the quad to turn to the direction of the target and move forward until it reaches the destination (this part is already done).

How do I calculate the yaw so that it turns to the direction of target? Calculating it using only the GPS co-ordinates is very inaccurate. If I use a magnetometer, the declination angle changes from place to place.

How do I calculate this? How does ardu pilot do this calculation?

Jonas
  • 121,568
  • 97
  • 310
  • 388
hck3r
  • 189
  • 2
  • 15
  • You have GPS information which is not so accurate according to you. But that should be good enough for magnetometer declination information at any location. You can make it as a table and look it up based on the current crude location information from GPS. – Hun Apr 10 '16 at 20:08
  • Have you `atan2(`) or `arctan()` ? – david strachan Apr 12 '16 at 21:08

1 Answers1

0

One way to develop control algorithms that deal with inaccurate measures is to combine different measures by some sort of filtering. In that sense, your set point reference is built based on both GPS and magnetometer measures.

There are several ways to accomplish this task. Many applications use data fusion based on Kalman Filters. The general idea is that you are going to use a predictor (or state observer) to achieve a better estimate of the heading. I suggest some research on these topics: data fusion, Kalman filtering.

Here is an example:

http://scholarscompass.vcu.edu/cgi/viewcontent.cgi?article=4188&context=etd

T. Degas
  • 11
  • 2