Spark Motor Controller Voltage Ramp Rate

Is there a way to ramp up the voltage on the drive train?

PID controlled drive train. During Autonomous, the wheels “burn out” for a fraction of a second which throws off the encoders.

I need a way to speed upto the setting instead of running the motors from 0 to .9 in 1 millisecond.

Joystick control doesn’t have this problem because it naturally speeds up as you move the joystick forward but Auto doesn’t do that.

In code compare the current power request to the previous power request and only let it increase/decrease by a limited amount.
For example, previous=0 requested=.95, allow a maximum .1 change, would then ramp up your drive by these amounts:
0, .1, .2, .3, .4, .5, .6, .7, .8, .9, .95

You could also incorporate the built-in Talon SRX capabilities if that’s the motor controller you have.

Could you provide an example? Another team helped us at our first comp and I’m not sure how they did this. I would like to learn how so I can implement this in our teleop on our latest code. Or is teleop and autonomoues completely different when it comes to “revving/ramping” the motors up? Here is the code we use for teleop:

public void teleopPeriodic() {
m_myRobot.tankDrive(-m_Stick.getRawAxis(1), -m_Stick.getRawAxis(5));

Are you using the PID to control robot speed or distance?

You could use a P controller for your speed which would affect ramp rate.

Please provide more information about your autonomous, so the answers can be specific to your situation.

Are you just commanding a fixed %voltage, and then stopping when the encoders say you are at the target?

Or are you using the encoders as feedback to a position PID, and you’re just setting your setpoint equal to the target position at the start of autonomous?

Or are you trying to follow a motion profile?

Or something else?