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.