Intentional versus wind drift

Realized overnight that the code changes I made yesterday won’t help wind-drift, but they are exactly what’s needed for horizontal speed control.

Lets look at two models

  • The horizontal speed control moves Phoebe forward because she’s been told to by a user input (autonomous or RC).  The force generating the earth horizontal movement comes about because Phoebe tilts, thus redirecting some of the vertical force from the propellers to the earth horizontal plane:  faz * sin(θ) and vertically: faz * cos(θ).  Feed these values into the horizontal and vertical speed PIDs as the feedback input results in a target value for θ fed into the absolute angles PID, which reduces as Phoebe accelerates up to the desired speed.
  • The model for wind is more complex; first we need to measure the acceleration applied by the wind; at a tilt, the measure of the wind force comes from both the X and Z accelerometers (assuming for the moment only a head or tail wind).  The feedback input to the horizontal acceleration PID is √(fax2 + (faz * cos(θ))2) (with some allowance for head or tail wind from somewhere).  The output then feeds the absolute angle PID to counteract this wind drift acceleration.   This angle will be constant as it is redirecting propeller force to counteract the wind acceleration force.

And here lies my problem:

  • The user controlled horizontal speed PID output supplies the absolute angle PID target with an ever changing value as the desired speed is obtained.
  • The anti-drift force PID output supplies a fixed absolute angle PID target to counteract the wind acceleration force

Leading to the question of how to merge these 2 PID outputs into a single target for the absolute angle PID, and do I really have to add a new wind-drift acceleration PID, or can I just take the measured wind force and convert the value into a desired angle, much like what happens with the output from the horizontal speed PID?

And that’s enough design thought to spoil my testing for today.

4 thoughts on “Intentional versus wind drift

  1. As I saw your reply yesterday, I wanted to respond this morning when I saw your edit 🙂

    I think all those cases are in fact the same case… you have a target tilt angle (zero for horizontal hover and non-zero when given a intentional user input). The perturbations (e.g. wind and others external factors) causing any sort of drift is what the PID meant to regulate for.

    As for what sensors/measurements to use, I’m thinking that it really should *not* depend on the situation (i.e. wind, no wind, stationary hover, or intentional movement)… With your accelerometer and gyro, you calculate the absolute angles in x, y and z, right? If yes, then that’s it! these are your inputs to be compared to the target angles…. Or am I missing something here?

    >”for intentional movement without wind, the feedback comes from the quad >Z (‘quad vertical’) axis sensor alone combined with the angles it’s tilted at, >since the power for the horizontal speed can only come from the tilted ‘quad >vertical’ props”

    I’m not sure I follow this… the z axis is for yaw, isn’t it? Why does that need to be taken into account for horizontal movement?

    • The z gyro axis is yaw, as you say – but the z-accel axis on a tilt wrt to gravity is both vertical and horizontal acceleration. Same sort of thing for the X and Y axes for the accelerometer. If the quad is flat and wind free, then the X and Y accelerometers can be ignored (and I do at the moment), but as soon as she gets tilted or blown around by the wind, then it’s a combination of the 3 accelerometers, reorientated into the earth’s frame which then provide the PID inputs for the horizontal acceleration / velocity if integrated. And it’s this mix and match of 3 axis in Phoebe’s frame into the earth frame that’s my next step, and it’s been haunting me for months as it’s approached by vector / matrix linear math(s) which I’ve not touched for decades!

  2. I think you might be looking at this the wrong way…

    the 2 “drifts” (intentional and wind-based as you called them) are not incompatible at all (I put quotes around the word drift as I don’t really regard the intentional one as drift, the word itself having a connotation of something undesirable caused by external events in my mind)

    When just hovering with 0 horizontal speed, your target tilt angle is zero, so your PID controls are here to satisfy this target of angle=0, so that any drift is being compensated. Now, when you want your quad to go to e.g. the left, you need to induce some horizontal speed for that direction. To do that, you must apply a tilt… that tilt is your new target… using the same PID as before! So if your intentional tilt is, say 10 degrees, then the PID (same as before) is there to keep that angle constant.

    • Yes, I agree wholeheartedly on the desired movement (intentional drift) side. A selected horizontal speed in a given direction causes a tilt down in that direction, which rises back to horizontal as the desired speed is attained. All clear.

      The problem is with wind – the ‘target’ here is not defined by a user command, but a need to compensate for wind detected by the horizontal accelerometers (assuming the configured targets are horizontal, stationary hover), so the PID target is to cancel out the wind drift, but that requires tilt, which then reduces the reading of the horizontal accelerometers measuring the drift, thus causing a change in the perceived drift.

      Yes, I agree they are different parts of the same problem, but the user configured horizontal speed is well defined, whereas the wind drift needs to be sensed, but in correcting it through tilting, the sensing of the drift needs to incorporate both horizontal and vertical accelerometers.

      Or put it another way, for the PID whose input is the desired angle, there are a set of targets to be merged: one defined by the user as the desired horizontal speed, and one set by the sensors,

      Started writing, but then started changing my mind – the conflict in my mind is the targets I’d identified for these ‘different’ situations: I’d considered both wind-drift compensation and user input as independent targets, instead of having a single, user-input target of “stationary hover”, and using the sensors to read the current state; I guess my problem is with a horizontal hover + wind, only the horizontal accelerometer can detect that, whereas for intentional movement without wind, the feedback comes from the quad Z (‘quad vertical’) axis sensor alone combined with the angles it’s tilted at, since the power for the horizontal speed can only come from the tilted ‘quad vertical’ props.

      At least I can see now it’s a single PID, and the problem is how to combine the result from the 3 axes of the accelerometers to provide the feedback. Why does this keep getting trickier? 🙂

      Thanks, I think!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.