Yaw control with compass enabled

Hi Folks

 

I am really having a problem with my yaw stability and I am hoping someone can point me in the right direction.

1st if compass is diabled in either Arducopter 2.x or ardupirates code. I have excellent yaw control just like on my mikrokopter.

If I enable compass at default PID settings, yaw hold is very sloppy (better at default values for arducopter 2.x) . for example in ardupirates code I have to increase P and D to 7.5 and 3.5 otherwise it keeps rotating past when I let go of the stick. But at these high PID values yaw is not smooth and hunts (not really oscillates) and the hunting affects roll and pitch stability

 

My Yaw gyro must be ok since without compass yaw is great. My compass heading seems ok and is relatively steady. but my issue is now with two different codes.

 

Is this a bad compass, or is this what other folks are seeing as well? if anyone was able to correct sloppy yaw - how did you do it.

 

Roll and pitch sabilization are perfect by the way

Thanks

Al

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Developer

    I expect the issues is that you have the orientation of the compass set up incorrectly in the code. 

     

    In AC2 you should modify the APM_Config.h, uncomment the #define MAG_ORIENTATION so that the orientation matches the way that you've actually mounted the compass.  The full list of orientations can be seen in the AP_Compass_HMC5843.h.

     

    In the NG code you need to modify the ArducopterNG.pde to change the #define MAGORIENTATION.  I'm not sure how it's done in the Pirates code but I expect it's very similar.

     

    good luck.

  • Developer

    The compass values are set to save after 7 minutes of flight. It's a slow save and can cause the loop to puase a few milliseconds. And it will eat the EEPROM if it's saved a lot. I also thought it would be good to get a full flight's data for the offset. We offset in the air now because it accounts for the electrical interference from the motors.

    Some compass are kind of noisy. Mine is +- 10 deg noise. That may be causing some issues. But even then my compass works great.

    Jason

  • If you use the zipped beta code with a DIY mag attached to wires instead of soldered, what is the default position you should mount it?

     

  • Developer
    Offsets are calculated in flight and take several minutes of the IMU being in motion to converge to a solution.  If you were for example to just hover very stationary for 10 minutes, the offsets would not get calculated.  It relies on seeing how the magnetometer vector changes when the IMU is pitched, rolled, and yawed.  Any time you reset your eeprom you can expect the mag to be "off" for the first flight or two till the offsets get recalibrated.
  • I'm also having problems with the compass. It worked grate on RC2 but now no chance, i've set dec. and it shows magnetic north but when i roll/pitch it it goes off.
  • Did another test without mag enabled and the stays fix.
    when changing nose direction with the tx the quad responds very crisp. Rather aggresive. You can hear the motors compensate the overshoot.
    But now if I fly forward it suddenly turns without stick input. It turns about 145° and then stays fix again.
    And this with the Mag off.
    Strange?
  • I just tried using 0 for my Declination and my APM is right.  It's pointing perfectly north with my colemen camping compass.

    what is this about?

  • I have a similar issue although I have not tried disabling the compass yet.  At the moment I am doing most of my flying in Stabilize Mode and I find that if the heli is pointing say North and I use the rudder control to rotate it round to point say North West, it will swing back to North again.  If I am persistent and move it round to say West (i.e. further round) it will go back to about North West.  Being a heli pilot and used to heading-hold giros, this seems a bit strange.  As soon as the demand for yaw from the pilot had ceased I would have expected the quad to stay pointing where it was.  I have not tried adjusting any yaw PID values.  I am in London using a declination of -1.56.

    (I'm using the latest (as at this morning) AC2 beta code on a 1280 board.)

  • Did you guys set your declination?
  • Just started out flying after I got xbee working.

    I'm having the same issue.

    With mag disabled I have a steady yaw. And boy when you stop rotating the quad stand directly still in that direction. Its almost like a tank turret ;-)

    When I enable mag the quad yaws to the left when going forward and right when going backwards.

    I've been playing around with the yaw pids but can't really see any difference.

    Is this a PID setting or should I look elsewhere.

     

    The quad flew very good with ardupirate code. 

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…