Order of coding Odom and PID

You can use kinematics equations to determine this. Luckily, @TheRichDarth made a lovely tool for calculating this here. You can apply the equations in your code to find flywheel RPM based on the distance from the goal.