2
$\begingroup$

I'm working on an autonomous quad copter, I have two GPS co-ordinates (source and destination co-ordinates). I need to move my quad from the source to the destination, for this I need to calculate the heading and set the yaw value of my quad. How can I calculate the heading and make sure the quad is headed in the right direction as the target co-ordinates?

If I use magnetometer the declination angle will vary from place to place and so I will have to keep changing the declination angle. If I'm calculating based on just the GPS co-ordinates, it's not accurate.

What is the best way to do this? How do I calculate the above?

$\endgroup$
1
$\begingroup$

The habitual way to do this is to have an attitude and position loop for the quadrotor, as in next picture.

enter image description here

Attitude loop manages the quadrotor to achieve the desired angles (pitch, yaw, and roll). Position circuit on the other hand, calculates which are those desired angles depending on the path you want to follow or the point you want to reach.

One GPS is used for desired position, while your other GPS should be used for actual coordinates.

Have a look at this thread where formulas and expressions are furtherly explained

$\endgroup$
1
$\begingroup$

A GPS unit doesn't give you heading, although it is possible to estimate the heading based on successive GPS readings. Unless you're looking to set and forget the heading, which you shouldn't be doing anyways because of wind and other disturbances, you should be using some form of a controller to do course correction along the path.

Say you don't correct for declination and just opt to accept the magnetometer as truth. This will put you on a (slightly) wrong heading for the destination. You should be filtering IMU output with the GPS signal to get a corrected position estimate that reduces drift from the IMU.

So eventually your corrected position updates and "tells" your controller that you're off course, so the flight controller corrects and alters the heading slightly to point at the destination.

This happens continuously, meaning that you'll take a sub-optimal arc instead of a straight line from origin to destination, but unless you're going to correct for declination angle, which you seem to not want to do, then there's nothing else really you can do about it.

$\endgroup$
1
  • $\begingroup$ Is that error without the declination angle is negligible ? I'm not using a IMU I'm using K.K board with a raspberry connected to it which will send commands to KK based on the GPS signal. Now I'm planning to interface magnetometer to the raspberry and which should figure out how much yaw should the kk do. $\endgroup$ – hck3r Apr 13 '16 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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