How to go about feedback control for a feedforward

One thing that has caused issues for my team in past seasons that involved launching game pieces has been that we can’t always get our shooter exactly to our target velocity. A simple motor feed forward (linear regression) usually gets us most of the way there, but it’s not perfect and it doesn’t correct for error.

I’ve tried implementing pid, but that causes issues because it becomes less effective as you approach your target, leading to an oscillation in voltage and speed.

How have your teams dealt with this, or have you just left it at a feed forward?

Have you seen: Combining Feedforward and PID Control — FIRST Robotics Competition documentation

Depending on the distance you might not need such a tight threshold around your setpoint for when to shoot so feedforward will be enough

4 Likes

Tune your controllers better, as P control (I and D control rarely help on flywheels) and the back-emf feedforward often give you pretty decent control.

Adding the back-emf feedforwards is simple and gets you low steady state error, while adding the P gain further reduces the steady state error and significantly improves recovery time. You can get decent enough performance by calculating the backemf feedforwards (kV) from theory, and then tuning kP until you both get low steady state error and no high-frequency oscillations. Too low of kP is clearly visible on graphs, where the high steady-state error shows up, and too much kP results in large overshoot and/or high frequency oscillations which are audible.

Integral control is difficult to use on flywheels becasue while it eliminates steady state error, it does so too slowly to be particularly useful on flywheels. Derivative control usually should not be ran on flywheels, as the double differention causes issues with latency and noise amplification, which are highly noticeable on flywheels that respond quickly.

3 Likes

Thank you so much. This makes a lot of sense.

one more note, choose a target velocity which is much less than your motor’s maximum speed. with battery sag during a match, the actual maximum speed will be much lower than the maximum at 12v. also, there’s very little torque (i.e. “control authority”) available at near-maximum-speed. you want maximum power. with reasonable current limits, the maximum power point for most FRC motors is something like 80% of your maximum speed (remember, de-rated for sag).

you can tell if the system is healthy just by listening to it: a slow exponentially-increasing whine is bad. in musical terms, you want a quick glissando to a specific note, and you want to hold that note.

4 Likes

Yes, thank you for that. We never experienced anything going wrong because of battery say all the way through the year until it cost us a qualification match at worlds lol. Definitely something to be diligent of next time :joy:

Not sure what tolerance you are expecting but I’d say, “That’s not going to happen!” We get “good enough” with a well-tuned P controller (of the PID) and often don’t need feed-forward. We do try to start the flywheel coming up to speed well before it’s needed and I’ve seen on CD that some teams leave the flywheel on all the time.

There are other controllers that work and you could try those for fun - Bang-Bang in WPILib and a Take-Back-Half.

The other comments posted here apply as to expect low-voltage and pay attention to the device performance curve and design the shooter to be robust as far as speed variations.

Some games require rapid shooting of multiple game pieces. A responsive controller such as P + feed-forward is essential to knocking seconds off the rapid repetition cycle time (last season not so much of a requirement).

1 Like