Yaw Drift -- Copter Rotates CCW

Could someone please take a look at this thread? viewtopic.php?f=80&t=8429

I originally placed it in the log analysis section, but I’ve done lots of log analysis already (you’ll see it from the posts).

  • Mini Octo with 2300KV tiger motors
  • Lumineer 12A SimonK ESCs
  • Pixhawk with 3.15
  • Custom built frame

It flies in X-Y well in Stabilize, Alt-Hold and Loiter. But in all three modes it slowly rotates CCW. If left alone in loiter, it will slowly rotate in a full Yaw circle over about one minute and 10 seconds. And this is with no stick input whatsoever.

  • The Magnetometer readings aren’t noisy (I’ve attached logs)
  • The ESCs are calibrated (using the all-in-one technique)
  • The radio is calibrated
  • The compass is calibrated with reasonable-looking MOffsets
  • The accelerometers are calibrated and the horizon indicator in Mission Planner is perfect

Based on the logs, it clearly knows it’s rotating. It’s remarkable how little noise the mag sees, actually. The MagZ reading is dead flat, and the MagX and MagY look like perfect sine waves – about 90 degrees out of phase with each other (as you’d expect from it making a perfect rotation).

And then I did another test: I strapped the copter to a fixture and ran the throttle from 0% to 100% in a variety of ways. When I plotted thr_out versus MagX, MagY and MagZ, they were all rock-solid (virtually no noise whatsoever).

So here’s the bottom line: APM knows it’s rotating. It knows remarkably well. But it’s decided to rotate anyway. I was afraid I might have some strange Yaw offset parameter saved in EPROM somewhere, so I then did a CLI erase, reset and reloaded everything – but that didn’t change the rotation at all.

I’m a wit’s end. Please help!

Brian

Here are the X and Y magnitometer readings when it’s loitering with zero stick input:

dropbox.com/s/h6b4n8epktm8r … gs%202.png

Here are the mag readings when it’s strapped into a fixture, with me running the throttle like crazy:

And look at the RCOut 1-8 values. Four of them are in the 1650 range and four are in the 1350 range. You can clearly see where the Yaw is introduced – It just has no reason to do it.

The 3, 4, 5 and 6 motors (all CCW) are getting about 300 units of more signal than the CW ones are, with no reason whatsoever.

  • The radio is calibrated and the sticks are zeroed
  • The AHRS_TRIM_Z is zero

So there’s nothing telling it to send those disproportionate signal levels to the motors. It’s just sending more power to the CCW motors.

Here are the RCOUT 1-8 values when the copter is tied-down and the throttle run over a wide range of values:

If its happening on the bench when stationary first place I would look is at what is being demanded, do you have some yaw trim on on your radio?

No yaw trim on the radio, but I wonder if the motors might be ever so slightly tilted in one direction. I have them mounted on tubes – but they should be drilled dead-nuts accurate.

I may slip very tiny spacers into the motor mounts and see if I can get all the motors pointing in the same net direction. I’m desperate at this point.

[quote=“bcdebusk”]No yaw trim on the radio, but I wonder if the motors might be ever so slightly tilted in one direction. I have them mounted on tubes – but they should be drilled dead-nuts accurate.

I may slip very tiny spacers into the motor mounts and see if I can get all the motors pointing in the same net direction. I’m desperate at this point.[/quote]

APM should fight that, that were happening I don’t think you would see an yaw, but one set of motors working harder than the others.

also if it were a wtwsited motor I don’t think it would happen on the bench, not at least till it had enough thrust to almost lift off allowing the spin in the first place…for the apm to fight against

[quote=“RabbitStu”][quote=“bcdebusk”]No yaw trim on the radio, but I wonder if the motors might be ever so slightly tilted in one direction. I have them mounted on tubes – but they should be drilled dead-nuts accurate.

I may slip very tiny spacers into the motor mounts and see if I can get all the motors pointing in the same net direction. I’m desperate at this point.[/quote]

APM should fight that, that were happening I don’t think you would see an yaw, but one set of motors working harder than the others.

also if it were a wtwsited motor I don’t think it would happen on the bench, not at least till it had enough thrust to almost lift off allowing the spin in the first place…for the apm to fight against[/quote]

I found the problem. APM fights slight motor misalignment, by running the CCW and CW motors at different levels. It costs you overall thrust though, since one set of motors limits the others. But at a certain misalignment (or greater), it can’t fight the yaw rotation.

Here’s what I found:

  1. If there’s more than about 250-300 msec difference between the motors (in terms of RCOUT pulse width), the default PID settings can’t stop a net yaw rotation.

  2. If you align the motors to get within 100-150 msec difference in pulse width, the default PID settings work.

  3. If you align the motors to get within about 50 msec difference in pulse width, you basically have full power.

Someone should get clever and write a log analyzer that looks at Loiter performance and recommends tweaks to individual motors in terms of rotation on the boom. It wouldn’t be hard to do.

Nice work, your findings are interesting.

@bcdebusk

Do you mean physically aligning the motors? I have seen the same thing, at an “annoyance” level, but would love to clean it up.

[quote=“Bill English”]@bcdebusk

Do you mean physically aligning the motors? I have seen the same thing, at an “annoyance” level, but would love to clean it up.[/quote]

Yes. I’m referring to slight rotational variance when using tubular booms.

You can eyeball them and even cheat with a level and the best I’ve been able to manage is about 50 msec between the CCW and CW motors. It’s surprisingly difficult.

For example, if you see one motor that’s cock-eyed, it’s easy to fix. but if you have something systemic (i.e. 3 or more motors that are imperceptibly off), it gets really difficult. It’s hard to see 1 or 2 degrees spread across four motors, but those errors add-up to a serious misalignment.

When everything is really tuned well, the average difference between CCW and CW motors may only be 50 msec. But even within the CCW or CW group, there may be a 10-20 msec difference between them. What would be really nice is a log analyzer that says:

Average Diff Between CCW and CW Motors: 250 msec
Recommendation: Rotate CCW motors CW or rotate CW motors CCW on booms
Order of Significance: CCW – Motor 1 is largest offender, followed by 2, 7 and 8
Order of Significance: CW – Motor 5 is largest offender, followed by 6 and 4

It wouldn’t be able to give absolute recommendations, since it wouldn’t know the individual motor thrust or the boom length. But it would be great to have a hit list of which motor to tweak and which direction to tweak it. My adjustments were as subtle as 2 layers of black electrical tape placed on the side of the motor mount. After compressing with screws, we’re talking a fraction of a millimeter at best.

Yes it takes bugger all for it to be off. I replied in a thread recently suggesting it was alignment and they didn’t seem to believe me. I maidened my quad today and it was 100ms off cw to ccw. I think it would difficult for an auto suggest tool. There are other things such as cg that also affect it.

I tweaked mine ange reduced the offset to over lapping. Strangely my vibes on z axis reduced too. Not sure if its related.

sent from my phone so apologies for any typos

[quote=“RabbitStu”]Yes it takes bugger all for it to be off. I replied in a thread recently suggesting it was alignment and they didn’t seem to believe me. I maidened my quad today and it was 100ms off cw to ccw. I think it would difficult for an auto suggest tool. There are other things such as cg that also affect it.

I tweaked mine ange reduced the offset to over lapping. Strangely my vibes on z axis reduced too. Not sure if its related.

sent from my phone so apologies for any typos[/quote]

Great point on the COG issue. I hadn’t thought of that.

What would be neat are carbon fiber booms with laser-marked ticks on each end. Then the mounting clamps could have a corresponding scale laser-marked on them so individual adjustments could be dialed-in.

Slight misalignment can have a pretty devastating impact on performance because it caps the output to the lesser of the CW and CCW motors. So if the maximum pulse is 1950msec but there’s a 200msec differential between CW and CCW motors, your true maximum output is 1750msec.

I’m still learning the lingo, so what is this “100ms” value you are talking about? I’m assuming 100ms?

How do you diagnose these value differences to work out your problem? :neutral_face:

Its actually 100 micro seconds not Mili seconds. The ESC is controlled by a voltage pulse signal. The length of time the pulse is high is changed between about 1ms and 2ms. 1ms is zero throttle. A perfectly set up multi copter should ideally have all pulse lengths the same for dead level flight. If something is off like weight or alignment or a weak motor etc the autopilot will have to correct for this and the demands to each esc will be different.

sent from my phone so apologies for any typos

[quote=“RabbitStu”]Its actually 100 micro seconds not Mili seconds. The ESC is controlled by a voltage pulse signal. The length of time the pulse is high is changed between about 1ms and 2ms. 1ms is zero throttle. A perfectly set up multi copter should ideally have all pulse lengths the same for dead level flight. If something is off like weight or alignment or a weak motor etc the autopilot will have to correct for this and the demands to each esc will be different.

sent from my phone so apologies for any typos[/quote]

Yes, my mistake. The “standard” (if there is one) servo pulse is on a 50 Hz frequency or a 20 msec period. The high pulse is supposed to to vary between one and two milliseconds (or 1000 to 2000 microseconds). In a perfect world, 1000 usec is zero throttle and 2000 usec is full throttle.

What I was observing was a systematic variation between the average pulse widths of the CW and CCW motors. Even the most meticulously designed vehicle will have slight differences, but in this case mine were clearly too large.

Put your own vehicle in loiter and just let it stay in one place for several minutes. Then plot all four, six or eight of the RCOUT channels. You’ll see just how much your motors have to compensate for vehicle imbalance, drift, misalignment, etc. etc.