Motor Power

The optical shaft encoder counts the ticks per revolution
After shooting a ball the rpm goes down, Is there a way I can force it to go up again?
If so how would I write that program

Write a function to monitor flywheel RPM, after a drop in rpm, the motors would compensate to recover lost rpm

Some nice samples here from jpearman. Give these a look over and see how you are observing the RPM and making some functions or control loops to adjust the RPM to what you want it to be. More power when too slow, less power when you are too fast.

Velocity calculation (as you are observing now)
https://vexforum.com/t/how-to-calculate-motor-flywheel-velocity-in-robotc/32336/1

A “Take By Half” control mechanism for getting back to the magical RPM you need to get to the goal:
https://vexforum.com/t/flywheel-velocity-control-revisited/30480/1

And some discussion on tuning TBH:
https://vexforum.com/t/tbh-tuning/30908/1

There are other means of controlling RPM but TBH seems to be the easiest to tune.

Try a PID loop. It essentially

  1. requests a operator to scecify a value
  2. once a value is set, it will make motors reach that rpm and maintain it, it corrects loss of rpm
  3. has a 60hz polling rate, can be changed to higher values

https://vexforum.com/t/a-pid-controller-in-robotc/20105/1

Is there code on easy c for any of these algorithms
Because I don’t know robot c too much in depth to implement jpearman’s code

You are going to have a tougher time implementing anything even slightly complex with EasyC. The bare bones idea is. Increase power slightly in proportion to how far off the goal velocity you are. If your really far away from the goal, increase power a lot. If your really close to the goal increase power by a little.