Automatic flywheel speed/puncher strength?

How can I write code to automatically set flywheel speed or puncher strength using only encoders? Our team doesn’t have any other sensors to do this. We have an H-drive if that’s important.

If your puncher is on a slip-gear than that would be impossible since it pulls back the same distance every shot no matter how fast you rotate the gear. For a flywheel you would need to use the encoder values to figure out the flywheel’s velocity, and then with some PID set target velocities for the flywheel.

For flywheel control alternative control loop include bang-bang and TBH(Take back half).
I would encourage you to look over the many threads from NBN about this topic.