Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actuator: Delay compensation via Smith predictor. #2044

Open
wants to merge 5 commits into
base: next
Choose a base branch
from

Conversation

glowtape
Copy link
Member

@glowtape glowtape commented Feb 3, 2018

Hope I did it right. Doesn't have any ill-effect at least in the living room. Can't test it outside yet, so I'm not sure what I'm supposed to be looking for.

Default delay is 3.2ms (for Seppuku x1.6 + 0.5, then rounded = 6 samples), the IIR has a default coefficient of 0.5, which creates a group delay of 1.4 samples. Should get in the ballpark of the 4ms mentioned before in IRC.

1);

for (int i = 0; i < MIXERSETTINGS_MIXER1VECTOR_NUMELEM; i++) {
desired_vect[i] += m->mix * (inv[i] - desired_vect[i]);
Copy link
Member Author

@glowtape glowtape Feb 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hoping this one is the right way. I had the terms of the subtraction switched earlier and it made things audibly worse.

@glowtape
Copy link
Member Author

glowtape commented Feb 3, 2018

Tried autotuning with this, it makes the yaw readings way worse.

@glowtape
Copy link
Member Author

glowtape commented Feb 3, 2018

False alarm, I changed to a pristine set of props, issue went away.

@tracernz
Copy link
Member

tracernz commented Feb 4, 2018

This is targeted at post-wired right?

P.S. Any ideas for post-wired name? :)

@glowtape
Copy link
Member Author

glowtape commented Feb 4, 2018

Wasabi. --edit: Wait, no, this also starts with W.

@glowtape
Copy link
Member Author

glowtape commented Feb 5, 2018

The predictor currently also mixes thrust into command, since that's also part of the inverse. Do we even want that?

@mlyle
Copy link
Member

mlyle commented Feb 6, 2018

I think we do-- if know we're underperforming on thrust, we want to fix it right?

@mlyle
Copy link
Member

mlyle commented Feb 6, 2018

god damn wrong button.

OPTMODULES += Battery
OPTMODULES += ComUsbBridge
OPTMODULES += Airspeed
OPTMODULES += UAVOHoTTBridge
#OPTMODULES += UAVOHoTTBridge
OPTMODULES += UAVOFrSKYSensorHubBridge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glowtape
Copy link
Member Author

On which config page should I stick the UI for this?

@mlyle
Copy link
Member

mlyle commented Feb 12, 2018

Let's prove it's good before adding UI

@glowtape
Copy link
Member Author

Seems like I need to get cracking on this. The other guys have implemented sorta Smith prediction on their throttle control.

@glowtape
Copy link
Member Author

So the loose idea I had anyway was an optionally purely filter based time delay (not in particular a fan of adding more noise than necessary :), as alternative to the sample based delay plus weak IIR. Separate values for throttle may be worth an experiment?

@mlyle
Copy link
Member

mlyle commented Apr 17, 2018

So the loose idea I had anyway was an optionally purely filter based time delay (not in particular a fan of adding more noise than necessary :), as alternative to the sample based delay plus weak IIR. Separate values for throttle may be worth an experiment?

Hm, I'm not really a fan.

1-- PID can effectively compensate for either pure-delay or exponential decay, but not both simultaneously.... the sample delay is what makes the smith predictor actually do something useful that doesn't mostly just commute with PID, the IIR is just to clean it up.

2-- throttle shaping, etc... how's this different from what smoothcontrol does? We already put in maximal effort to deliver requested throttle with the clip management.

@glowtape
Copy link
Member Author

glowtape commented Apr 17, 2018

Yeah, was just a bunch of random ideas.

Rebased to fix conflicts. Added some minor massaging of the throttle signal, after noticing some motor grinding when on the ground with hangtime or very low throttle (took me a while to figure that one out).

@glowtape
Copy link
Member Author

What about a second order lowpass? The step response of one is kinda delay+IIR-ish, given the desired delays (4-7ms), if you squint your eyes. If it's remotely applicable, we could keep the noise down, which in turn would allow cranking up the contribution to the control signal.

@mlyle mlyle modified the milestones: Ludicrous, Inconceivable Apr 18, 2018
@mlyle
Copy link
Member

mlyle commented Apr 18, 2018

Put back into inconceivable for now, just for consideration.

@glowtape
Copy link
Member Author

@ufoDziner These are the Smith predictor artifacts.

@dronin-ci
Copy link
Collaborator

Artifacts built, by request of @glowtape

@glowtape
Copy link
Member Author

@ufoDziner I nearly forgot. You should probably set ActuatorSettings.SmithPredictorMix to 0.3 to start (lower than the default in this PR) after installing.

float r = t+v;

/* Don't cross zero via prediction. Also bound throttle. */
if (sign(t) == sign(r))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis isn't quite what we want, because if you overperform significantly and throttle is 10%, and it wants to lower it to -2%... we should still lower it to throttle epsilon.

@mlyle
Copy link
Member

mlyle commented May 4, 2018

Is this something we want to try and merge for inconceivable? If so, it should lose the WIP tag and go through review.

@glowtape
Copy link
Member Author

glowtape commented May 5, 2018

We have the anti-windup changes in PID and then the LQG. It would be interesting to get people flying these changes before adding another influencer on control. IMO we should shove it off to Ludicrous. I'd probably want to run another round of logs eventually, to check its behavior at low and high end of throttle.

@Quick-Flash
Copy link

I've ported some of this over to EmuFlight, but instead did the smith predictor on the gyro data and have had great results with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants