MultiWii - Yaw Hold... not holding.

Post Reply
doppler
Posts: 64
Joined: Wed Sep 26, 2012 1:35 pm

MultiWii - Yaw Hold... not holding.

Post by doppler »

I've still been very much struggling with MultiWii on Quadcopters with Yaw Holding. The software just simply doesn't try and counter any yaw noted in the gyro that happens without stick input. See picture, yellow highlight is the yaw in question, and the purple highlight is my yaw input to put the copter back to the yaw position I wanted it at. As you can see, on the gyro graph there is a significant negative yaw reading (yaw to the left) with no stick input. This was in the house, about 4 feet off the ground, and just happened, and is quite repeatable. As you can see, it behaved itself with no stick input for quite some time, the suddenly yaw. I've never had this issue with KK style boards (old and newer 2.0 board), but MultiWii has so many nice features, and a Self level that works without destroying the quad when you put it on an angle, with this one thing.... it would be perfect. PIDs for Yaw are set quite high, 15.0, 0.250, 5, I don't like having it at 15.0 and .250, slows down yaw on stick quite a bit, but it's the closest thing to "hold" i've found.

Thanks to Ezio for his Android MultiWii app and the new logging function, I was finally able to catch it with some real data!

Andrew
Attachments
2013-04-29_21.13.01_01.png

doppler
Posts: 64
Joined: Wed Sep 26, 2012 1:35 pm

Re: MultiWii - Yaw Hold... not holding. - Updated

Post by doppler »

Update, it was occuring to me, that Yaw just wasn't being given the strength to hold the quad in yaw place. I noticed that when I twist the quad with my hand, very little force is applied by the blades to reverse this, my kk boards and even my MQX give noticeable reactions to the twisting to resist the change.

So, it occurred to me that I had noticed in the past code that indicated private mixing setup, the default for quad-x from output.ino; (not all the code just pieces that I've modified)

Code: Select all

 #define PIDMIX(X,Y,Z) rcCommand[THROTTLE] + axisPID[ROLL]*X + axisPID[PITCH]*Y + YAW_DIRECTION * axisPID[YAW]*Z
 
    //prevent "yaw jump" during yaw correction
    axisPID[YAW] = constrain(axisPID[YAW],-100-abs(rcCommand[YAW]),+100+abs(rcCommand[YAW]));

    #ifdef QUADX
      motor[0] = PIDMIX(-1,+1,-1); //REAR_R
      motor[1] = PIDMIX(-1,-1,+1); //FRONT_R
      motor[2] = PIDMIX(+1,+1,+1); //REAR_L
      motor[3] = PIDMIX(+1,-1,-1); //FRONT_L
    #endif

I have creatd private_mix.h and uncommented the necessary section in config.h to include it, private_mix.h has;

Code: Select all

#define PIDMIX(X,Y,Z) rcCommand[THROTTLE] + axisPID[ROLL]*X + axisPID[PITCH]*Y + YAW_DIRECTION * axisPID[YAW]*Z

#if NUMBER_MOTOR > 3
  //prevent "yaw jump" during yaw correction
  axisPID[YAW] = constrain(axisPID[YAW],-75-abs(rcCommand[YAW]),+75+abs(rcCommand[YAW]));
#endif
/****************                   main Mix Table                ******************/
    motor[0] = PIDMIX(-1,+1,-5); //REAR_R
    motor[1] = PIDMIX(-1,-1,+5); //FRONT_R
    motor[2] = PIDMIX(+1,+1,+5); //REAR_L
    motor[3] = PIDMIX(+1,-1,-5); //FRONT_L



Note that yaw is now + and - 5. I started with 2, didn't cut it, was better however. 5 seems good so far, only one test flight however but when I grab the quad and twist it, it fights back strongly.... I'm looking forward to getting it outside and giving it the go. I'm also working on the perfect yaw jump number, 75 seems good, it jumps not much, 50 caused the quad to lurch to the right on yaw completion, definitely not good. 150, hopped like a bunny :)

Andrew

Electro 2
Posts: 27
Joined: Tue Mar 19, 2013 4:05 am

Re: MultiWii - Yaw Hold... not holding.

Post by Electro 2 »

Too weird, on mine the yaw axis is the most stable. Only an occasional nudge to keep it true. On mag hold, absolutely rock.

doppler
Posts: 64
Joined: Wed Sep 26, 2012 1:35 pm

Re: MultiWii - Yaw Hold... not holding.

Post by doppler »

So I've had time to take it for some outdoor flights and have some very promising results.

With the Yaw mix set to +-5, Yaw holds perfectly, my quad on 2 cell flies very smoothly. On 3-cell there is excessive yaw hop on aggressive yaw movements.

I have now also tried +-3 for Yaw, looks like hold is almost as good as +-5, needs a more robust test, Yaw hop is less, but not yet acceptable, working on that. I'm not sure I'll ever have something that doesn't require tweaking to support both 2 and 3 cell, looks like I have to decide what type of battery this quad is going to use.

Andrew

User avatar
alll
Posts: 220
Joined: Fri Dec 07, 2012 9:53 am

Re: MultiWii - Yaw Hold... not holding.

Post by alll »

Interesting, will try it also, i too don't really like the mwii yaw implementation. I thought Alex will change this in the next release? Alex?
manu

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MultiWii - Yaw Hold... not holding.

Post by Alexinparis »

alll wrote:Interesting, will try it also, i too don't really like the mwii yaw implementation. I thought Alex will change this in the next release? Alex?
manu

yes, it's still on the todo list. I didn't forget ;)

doppler
Posts: 64
Joined: Wed Sep 26, 2012 1:35 pm

Re: MultiWii - Yaw Hold... not holding.

Post by doppler »

alll wrote:Interesting, will try it also, i too don't really like the mwii yaw implementation. I thought Alex will change this in the next release? Alex?
manu


I see Alex has replied with an affirmative to that request, that is great news! In the mean time, I've been doing some more experimentation, as I mentioned with my motor mixing, all is good with Yaw except Yaw hop... I was thinking, what is yaw hop? Why does it happen, well to yaw you need to slow down two motors and speed up two others, various other mixing occurs as well depending on the orientation of the quad.

When you stop Yawing, the motors that slowed down speed back up, the motors that had been sped up, slow down, problem is normally motors don't slow down as quickly as they speed up, inertia fights their slow down and we have to rely on friction to help out, doesn't last long, but for a split moment, there is higher overall thrust. So how can we fix this, I've been using simonk HK F-30a ESC's, I downloaded and recompiled the source to include comp_pwm which uses the esc fets as a load to a motor when it's over spinning.... I just finished updating all the ESC's and my first test flight.


WOW, WOW, WOW, first, it's a lot more stable (less rocking) then with just plain ole simonk, but yaw hop has been eliminated...... I'm literally shaking with the sudden progress that has been made, I can't wait to take her out again! :D

Andrew

User avatar
alll
Posts: 220
Joined: Fri Dec 07, 2012 9:53 am

Re: MultiWii - Yaw Hold... not holding.

Post by alll »

If you are lucky to find esc's that can handle comp_pwm, it will add a breaking effect when motors are slowed down. This is really important do have fast response for both rev up as well as slow down commands! So yes, comp_pwm contribute to multirotor stability.
I would even go further, that if the esc firmware implement a PIDclosed loop so that a motor react better to given input commands. But the esc hardware has to follow in that case and quality/fast mosfets are needed. Ultraesc is mayby the next big improvement to multirotors.
If you have an esc with comp_pwm enabled (even without), implementing a "normal" yaw pid loop is enough IMO, just a matter of tuning it, and this is maybe the hardest part ;)
manu

Phil S.
Posts: 32
Joined: Fri Apr 26, 2013 7:59 am

Re: MultiWii - Yaw Hold... not holding.

Post by Phil S. »

Reminds me of the development of helicopter FBL systems over the last couple of years. Anything was wrong, servos, blades, vibrations, center of gravity, ..., but the software. Nowadays (CGY750 V1.3, Microbeast V3.x.x, 3GX V3.x, ...) you take the servos you like, the blades (even the old paddle stuff) and all the rest, make your setup step by step as described in the manual, and the helicopters fly exactly what you want them to do, from ultrafast 3D to topspeed without pitching up.

I crashed my quad two days ago, trying out dopplers YAW tweak (but crashed because of dusk, couldn´t see what is tail and what is nose any more) and destroyed a lot, controller included. As I wanted to fly yesterday I had to take the old HobbyKing KK5.5 copy FC and now I know again, how a quad can feel at the sticks, a Gaui 500X out of the box, stock motors and ESCs, plastic props out of the bag, without any balancing! That´s fun, not the impression of beeing steered by someone else or waiting for the next surprise MultiWii will present. (I tried Megapirate as well, but it´s even worse in that regard.)

So don´t blame ESCs, bearings, props and all the stuff around, there is a lot to do with FC software, I suppose.

Philipp

mopedcrosser
Posts: 52
Joined: Sat Feb 23, 2013 12:35 pm

Re: MultiWii - Yaw Hold... not holding.

Post by mopedcrosser »

Hi all,

I have a similar problem with the Yaw hold. After setting a defined heading via stick input the copter turns to the right for about 5 seconds and approx. 10 degrees. This only occurs when I turn the copter to the left, it will turn back to the right a bit as described. The problem does not occur noticable if I turn the copter to the right. This is weired in my opinion, since the copter has the correct mag reading and "sees" that it is not maintaining the heading.

A little example to clarify the behavior.

1. I turn the copter to the left until I have a heading of 100 degrees and stop stick input at that time.
2. The copter turns very slowly within 5-10 seconds a bit back until there is a heading of 90 degrees and maintains that heading perfectly.

So how can that be ? The copter should know that it has to maintain the 100 degrees and it sees that it drifts of ? So at this point something
else seems to be able to influence the heading. Probably the z gyro suggesting the copter is still turning left because of a delay ?!? However,
this might be a software issue, since the 100 degrees should be maintained. Could someone please explain or doublecheck what influences the
heading ? In my opinion a gyro doublecheck is useful in case the mag fails.. but maybe it is set up to sensitive..

Best regards

Seb

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: MultiWii - Yaw Hold... not holding.

Post by Alexinparis »

mopedcrosser wrote:Hi all,

I have a similar problem with the Yaw hold. After setting a defined heading via stick input the copter turns to the right for about 5 seconds and approx. 10 degrees. This only occurs when I turn the copter to the left, it will turn back to the right a bit as described. The problem does not occur noticable if I turn the copter to the right. This is weired in my opinion, since the copter has the correct mag reading and "sees" that it is not maintaining the heading.

A little example to clarify the behavior.

1. I turn the copter to the left until I have a heading of 100 degrees and stop stick input at that time.
2. The copter turns very slowly within 5-10 seconds a bit back until there is a heading of 90 degrees and maintains that heading perfectly.

So how can that be ? The copter should know that it has to maintain the 100 degrees and it sees that it drifts of ? So at this point something
else seems to be able to influence the heading. Probably the z gyro suggesting the copter is still turning left because of a delay ?!? However,
this might be a software issue, since the 100 degrees should be maintained. Could someone please explain or doublecheck what influences the
heading ? In my opinion a gyro doublecheck is useful in case the mag fails.. but maybe it is set up to sensitive..

Best regards

Seb


I would suspect first either
- a motor inclination issue
- a propeller differences
- a wrong ESC calibration
that induces a constant torque.
Once locked, the yaw PID tries to correct the error. And the I term goes up to its limit slowly.
That could explain the asymmetrical behavior and the limited drift.
You can try to zero I and the drift should go, but the lock should then be less accurate.

mopedcrosser
Posts: 52
Joined: Sat Feb 23, 2013 12:35 pm

Re: MultiWii - Yaw Hold... not holding.

Post by mopedcrosser »

Hi Alex,

thanks a lot for your hint.. I was pretty picky when I set up the props and motors since I knew it would cause trouble if they aren´t aligned properly.

While trying your suggestions I found the reason for this problem.. It´s a shame and I really hate myself for not coming up with the most simple idea
ever :oops:

The reason for this problem was that the yaw stick had in its mid position 1511 microseconds. Since this doesn´t matter on all the other axis (and is not
adjustable in many RC´s) because you have to calibrate ACC anyways I did not realize that the yaw is not related to ACC. I really wonder why the copter always
stopped after a little while of this constant input, but after setting the midpoint to 1500 everything is totally fine now. Sorry for beeing so dumb and bugging you
with this stupid problem... All the beginners guides should say that you should use the RC´s trim for yaw but not for the other axis...

Thanks again

Seb

Zenman
Posts: 7
Joined: Tue Jul 16, 2013 4:46 pm

Re: MultiWii - Yaw Hold... not holding.

Post by Zenman »

I don't know if this would be relevant but I have noticed there is a define for setting a deadband around the stick centers. I have wanted to try this but haven't as I would only want it for yaw and not for pitch and roll. I think it would be useful for yaw to help the rc signal stay at 1500 and centered since there is always constant throttle adjustment happening throughout flight and some radios are twitchy. This might also help with some of the drift issues. Is there a way to add a deadband to only the yaw and not pich and roll? I would want to keep imediate reaction in place on my right stick.

MYSQL
Posts: 10
Joined: Fri Sep 13, 2013 4:34 pm

Re: MultiWii - Yaw Hold... not holding.

Post by MYSQL »

Thank you for this thread.

My octocopter had been suffering from terrible yaw control. Wind would be able to spin it around. Descending would make it turn direction all over the place.

I tried hovering the octo over my head, then I'd grab it by the bottom to rotate it -- there was almost zero resistance. It let me turn it any direction without fighting. Yaw only -- pitch/roll would resist properly. The PID / Rate settings would not work to fix (I tried from super low to super high values).

Today I tried the +5/-5 setting, but it was WAY too powerful. 3 worked well, but I think 2 might be better.

Woohoo!

giiba
Posts: 23
Joined: Tue Apr 22, 2014 6:20 am

Re: MultiWii - Yaw Hold... not holding.

Post by giiba »

I've been having weak yaw hold in a breeze with my micro quad. I stumbled upon this and like the results. I've settled on 3 for the yaw mix, and am now tuning PID's. I've been able to improve hold and lower my gains significantly. Did this sort of thing ever make it into default code (the Yaw Jump bit especially)?

Post Reply