I’m seeing a lot of shooters shooting faster than ours, so the question is how did they get PID to return so fast ( >4 balls per second).
Our team is using an 8in pneumatic wheel direct drive to a cim, and we are getting about 1.5 balls per second when waiting for PID.
Try adding mass to the rotational axis of the flywheel. It will take more time to reach your required speed, but once reached - it will decrease far less between balls fired.
+1. More rotational momentum (by adding more mass to the flywheel) makes a world of difference. In addition, some teams will have multiple shooters on their robots.
How would the amount of momentum taken by the ball or added by the motor change?
The gist I get from the programming team is that the Talon SRXs only feedback velocity information from the encoders on a 100ms timeframe, so making a control loop respond to multiple balls per second is extremely difficult with that route. Running the encoder into the digital I/O ports on the rio lets you make your own control system that is more responsive.
This is a good question, and most likely the answer is “It won’t.”
However, it will have a positive effect on your shooting characteristics. It will help the PID get back up to speed and stabilized, because it will increase the dampening in the system. Also if your shooter’s RPM is off by some given amount of energy when a ball is fired, it will have a smaller impact on the shot.
On the other hand, the best advice I can give you is to increase the cycle rate of your PID and give the shooter more available power.
There are many ways to increase cycle rate, but only two ways to increase available power. Either gear the shooter to the power band of the motor you are using, or increase the amount of motors.
Hope that helps! (When in doubt, focus on gears and climbing)
If you use the built in pidf control on the talons themselves, your motor loop runs really fast. This is probably a better route than running it on your roborio. The software manual for the talons also suggests that you can change this 100ms can bus encoder update rate to be faster (can be set to 20ms), but you shouldn’t need to use this at all. My recommendation is to add more mass on to your flywheel, and experiment with a feed forward gain term if you are using talonSRXs.
PID sampling rate can affect your responsiveness as mentioned above, but physical setup is more likely your issue. More mass to the flywheel means it will have more inertia at speed. You need more energy to get to that inertia, so a longer ramp up, but the energy each ball takes from the shooter will be a lower percentage of the available inertia with the higher mass. I’d also look at your gearing, compression, and wheel contact time. A 1:1 ratio on an 8" wheel seems fast to me, since some Ri3D robots were shooting at the high goal with wheels half that size. I didn’t look at their gearing, but direct drive CIM on a 4 inch wheel would give you double the available torque, which should decrease your time to spin back up to speed. More motors is also an option.
The rule in industry is, you don’t fix mechanical problems with programming.
The motor stays the same. It is the addition of the flywheel that matters.
Let’s say that the wheel is spinning at 600 rpms, and declines to 550 rpms after a shot. You have to wait for the wheel to spin back up to speed.
After adding the flywheel, the 600 rpms delines to 590 rpms after a shot. The motor then goes to 100% to speed back up to 600 rpms. You can then shoot as fast as the motor can deliver energy to the system.
How fast is your motor spinning when you’re at during speed? If the motor is spinning near its free speed, there isn’t much torque available to soon the motor back up to speed. You should have the gearing set up so when your wheel is at target speed, the motor is spinning at about 60% free speed. Then when your PID kicks the motor output up to 100%, it will dump the most power it can into the wheel to get it back up to speed.
You can actually drop it all the way down to a single millisecond.
That said, I suggest using the TalonSRX Speed Control Mode. You can set FPID values that should be able to get it up to speed very quickly and very consistently. While all mechanical systems are different, we had a two-wheeled shooter without any flywheel that was speeding up after shooting a ball in less than a tenth of a second.
The Talon closes the loop much faster than the roboRio WPI classes (by default). I think the Talon is nearly 10X faster. The 100ms comes up because the Talon counts pulses per 100ms instead of pulses per second - my guess is they do it to make the internal integer math easier. But, for sure, the 100ms thing has zero to do with how fast the Talon’s close the loop.
HTH
Another thing to consider is reducing the amount of energy lost per ball. If your system compresses the ball a lot during a launch, more energy will be lost - which needs to be replaced.
Fuel weighs about 0.0707 kg, launched at 6 m/s will have an energy of 12.73 J
(https://www.wolframalpha.com/input/?i=energy+of+a+0.707kg+mass+travelling+6+m%2Fs)
Shooting five of these per second is only 64W - ignoring other loses. Those other loses could be hampering your shooting rate.
According to both the documentation and CTRE, the Talon control loop runs every millisecond. It is very possible to use the Talon for closed-loop code. I think you can apply the Cheesy Poof rule here: 254 uses closed loop velocity control on the Talons, so you can too.
Direct drive may be sub-optimal, depending on your target wheel speed. Try to have the CIM running at about 50% speed when your wheel is at full speed.
This allows the motor to have sufficient “headroom” to pour in the power when needed.
We are running a 775 at 5:1 reduction, wheel speed is about 1000 RPM* on an 8" solid wheel. Our shot doesn’t go much higher than the fuel inlet (by design).
*(I may be mistaken on this value, but I don’t think it is higher than 2000 RPM)
What are you using to add mass to the wheel? We’re using a pneumatic wheel… I guess we could add weight to the hub somehow…
Keep in mind that the further the mass is from the center of rotation the more effective it is (if my memory of physics is correct anyways). ::rtm::
I’ll second this. Our initial prototype would audibly slow down when we shot a single ball because we had too much compression involved. With our final design, we have less compression on the ball and a more compliant shooter wheel. I don’t think we’ve done the PID loop for it yet (waiting for some new sprockets to get in so we can test different ratios), but we can gravity feed in a line of balls (maybe 5 balls/second) with no noticeable change in the wheel speed or power of the shot.
A note on using the TalonSRX for FPID control. You need to use an encoder with enough ticks to give you a high enough resolution to get good feedback. The more ticks you can fit into the 100ms velocity read the higher the resolution you will have.
A good way is just to add something with more mass to the drive shaft. I have seen some robots that just bore out a piece of solid stock and put that on the driveshaft. Another option might be to use something like an AM performance wheel (made of aluminum, mass is further away from the center).
In a physical sense, you are trying to increase the mass moment of inertia of the shaft driving your shooter (or another shaft in the system), such that the entire system has a greater angular momentum while at the desired operating speed. Assuming that in all cases the fuel is being launched in an identical way, the impulse that the shooter will impart on the ball (impulse is a force over a given time, or alternatively an acceleration over a given time), each fuel fired should “take away” a constant amount of angular momentum away from the system.
Now, here’s the fun part. As you increase the mass moment of inertia of your system, you increase its angular momentum at the operating speed. So, when you fire a fuel out of your shooter, that loss in momentum (the impulse applied to the fuel) is a smaller fraction of the total momentum. So, the angular speed (the rpm’s) of your system will decrease by a lesser amount. This means that the system is closer to the operating speed after firing a fuel.
To get back to operating speed, the motor has to apply the same energy in all cases, because the fuel still left with the same energy it did is the previous case (neglecting friction because hopefully you used decent bearings). HOWEVER, since your speed loss was less because the fraction of angular momentum lost was less compared to the overall angular momentum of the system, the chances are that your system is closer to or still within the tolerance range for acceptable shooter speeds to reach your target (ie. you can still make your shots because your rpm’s only changed a little). So, by increasing the rotational inertia of your system, the speed will decrease less per shot, meaning you can make more shots more quickly while holding your speed within the appropriate ranges.
Now, you still will lose some speed after every shot. This is why you need to design your system such that, after a shot, the controller (probably a PID loop on a Talon) can add more power to the system. By gearing so that the right speed comes at ~50% (plus or minus a bunch depending on your taste) the maximum speed, when fuel is fired, there is more overhead for available power from the motor to be delivered to the system, so you can recover more quickly. Additionally, if you design to run at 100% speed, you run into issues where battery voltage and draw from other robot systems might prevent you from ever reaching your target speed.
So, back to your question of how to add mass (increase inertia):
Add something with mass to a spinning part of the system (think flywheel). As you add mass, the system will take longer to reach speed (“spin up”), but once there, it will remain at speed for a longer time (all the discussion above about momentum). If you are driving the system with something like a VP, the only real place to add mass is on the main output shaft. However, if you are doing a custom system, or have a stage after the planetary like a chain reduction, you could also add more mass before the final stage. The faster it spins, the more inertia it has, so by adding mass to an earlier stage in the system, you can theoretically get more bang for your buck by increasing momentum more while allocating less of your robot’s weight to the flywheel. Also, something like a performance wheel is great because the mass is farther from the rotational axis, so its inertia is greater than just a simple hub, even though they have the same mass.
Another thing: be safe. Think about where the mass is located. Can it grab someone’s finger? Is the shaft it is spinning on well supported so that the spinning mass doesn’t fly apart? Is this much angular momentum safe (see all the spinning Battlebots that are basically gyroscopes that fly all over the place when disturbed)? Is the torque required on startup to great for the motors being used (it is probably possible to have too much mass)?
OK that’s a lot of words.
tl:dr;
-spin up as much mass, located as far from the rotational axis as possible, as fast as possible (without creating a spinning death machine).
-gear smart so you have more power available to recover speed lost to firing fuel