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)

A “Take By Half” control mechanism for getting back to the magical RPM you need to get to the goal:

And some discussion on tuning TBH:

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

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.