Hey Vex forums! I currently have a single flywheel setup using 4 motors, 2 on each side of the flywheel going into a 84:36 compounded to a 60:12 with the 12 on the same axle as the flywheel. I’m using turbo internal gearing and an IME on one of the motors. My question is within robotc how would I calculate the current actual velocity from the IME? I’m trying to use this in a PID Loop to make my flywheel more accurate. Also would it be beneficial to have one IME on both sides of my single flywheel and run a PID Loop for both? Also which have you seen produce the most accurate results TBH, Written PID, or RobotC’s Internal PID Calculator? This is my schools first year competing in vex and any help is much appreciated! Im going to attach my current .c file for it but keep in mind I’m very new to coding for robots.
Here is a link to my google drive for my .c file
See this thread.
If you really want flywheel velocity then the total external gear ratio will be
(60:12) 5 x (84:36) 2.33 = 11.66 (I think that’s what you are trying to describe anyway)
I will look at you code later.
Did you ever get a chance to look at my code? @jpearman
I did look at the code, not sure what additional advise I can give you beyond that which is being given in the many other threads discussing PID.
I do notice that your “velocity” is really the absolute encoder value and not velocity.
long GetVelocity ()
return( nMotorEncoder FROne ] );
velocity = GetVelocity();
velocity is proportional to the change in encoder count, not the absolute encoder count.
@jpearman So If I used the velocity calculation you use in your TBH algorithm code would that work for this?
That would calculate velocity. There is also an in depth analysis of different ways to calculate velocity in this thread.
You need to decide what your units are, all the code I post uses revs/minute, ie. angular velocity. If you use these then the “target” for the PID calculations needs to be in the same units. It looks like your existing code is trying to use something else.