# Speed sampling ideas

I need some ideas. We have a shooter with 2 cims that shoots full field. The speed needs to be pretty high on the shooter to make the shot.

I’ve noticed as our intake system turns on to push balls up to the shooter, usually the first ball out of 5 ends up being slightly low. This leads me to believe because the intake system with 5 balls in it, takes more current to run, it draws down the shooter.

It seems that after that the shooter seems to be able to handle the current draw from the intake system, and make the other shots.

What I wonder… is is there a way I can account for this. Currently in our software we are using a velocity pid, and we sample a few times in the software to verify we are at or above the required speed, if we hit the minimum number of occurrences, we jog the intake up. My guess is when we jog the intake up, thats when we experience the shooter slowdown. Everytime we loose a ball from the intake, it takes less current to run the intake.

Does anyone have any ideas as to how you’d combat that? Timers on the shooter? Current ramping the intake system? I know mechanically they are looking at bearings to try to help friction… but I am curious what else we could do!

Just wanted to ask the smart people here what they thought

One option would be to enable voltage compensation mode on your speed controllers and set it to a voltage like 11 volts. Assuming you’re using speed controllers that have voltage compensation.

using talons… what does voltage compensation mode do? like I think I understand it… but could you explain to me your thining?

Another possibilty is that your first shot is at the speed that is being requested, but then by the time your second shot goes through the velocity PID has “overshot” (see image below) above the setpoint and is above the requested velocity.

One solution for this is to not only check if the shooter is above a speed, but also below one, I.E. is the velocity of the shooter in a tolerance of what is being requested.

Example PID Overshoot Tuning

1 Like

great idea!

Essentially it’ll scale your requested output by the supply voltage at that moment in time to compensate for any voltage drop.
For example.
Without voltage compensation, a 50% output with 12V supply will be 6V effective output, and if the supply drops to 10V, output turns to 5V. This causes inconsistencies based on battery voltage.
With voltage compensation of 12V, a 50% output at 12V supply is still 6V, and if it drops to 10V, it’ll still output 6V.

Note this cannot be used to bring a voltage above the supply voltage, so a compensation of 12V and supply of 10V at 100% output will still only output 10V, not the full 12V you requested. That’s why Tom and the documentation suggests a saturation voltage below your nominal voltage to give yourself some wiggle room.

For Talon this is in effect all the time, including closed loop operations. It may improve consistency if you are seeing an issue with other mechanisms causing a drop in voltage.

1 Like

how is the talon able to do this? does it prioritize certain talons or something

Are you utilizing current limits?

At speed, your shooter CIMs aren’t drawing a lot of current.
As the bus Voltage is drawn down, by other loads, the speed will decrease.
Speed is proportional to Voltage!

Your intake probably doesn’t require a lot of current.
What type if intake motor are you using - what gear ratio?

we tried to set a current limit… maybe doing that more would help

Pretty much repeating @TytanRock.

Without compensation

If you set the TalonSRX to a %output, the TalonSRX will output that percent of its own supply voltage.

Eg If you command a TalonSRX to 50% and it has 12V available, it will output 6V to the motor.
If only 10V are available (battery low, lots of current draw, etc) it will output 50% of that, or 5V to the motors.
This creates some problems.

With compensation

• You tell the TalonSRX what 100% output is as the reference voltage (eg 12V)
• You command the TalonSRX to 50%
• If 12V are available, it will output 50% of the supply voltage, so 6V to the motors
• If only 10V are available, it will silently increase its own %output so that it outputs 50% of the reference voltage (but it’s actually 60%). 60% of 10V is 6V

Therefore compensation has increased its output to compensate for the voltage drop of the supply.

It doesn’t need to talk to any other TalonSRXs or prioritise anything over anything else.

1 Like

would this have any effect with a velocity pid? Figured it wouldn’t matter since it isn’t applying its own percent output… am i wrong?

Yes. It can have an effect on velocity PID

. A velocity PID
is essentially a function that accepts some parameters (setpoint, current point, etc), and outputs a percentage to drive.
Voltage compensation then compensates that percentage based on supply voltage. So it will do its best to keep it consistent throughout different voltages.

Imagine your velocity closed loop wants the motor to output 50% power, then follow the examples above to figure out how voltage compensation may improve the response over different battery voltages.

I’m not saying that this is the solution to your issue, but it may improve it. It could be something entirely unrelated to supply voltage and this may not have any effect at all. It’s easy enough to implement so I would suggest you try it out.

1 Like

Absolutely. Thanks for taking the time. I will try it out!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.