Is it Possible To Control Speed During Position Control Mode? (With the Talon SRXs)

My team has just recently decided to put encoders on our drive train for better control during auton. We’re controlling them using Talon SRXs and a position controlled loop but every time we pass it a number of rotations we want it overshoots.

We could use a PID loop to account for the overshooting and I think we will, I just don’t want our robot flying around at max speed during auton. Anyone know a way we can control speed during the position closed loop?

More info needed to disambiguate your post.

What kind of “position controlled loop”? And where is it executing (i.e. in roboRIO or Talon)?

but every time we pass it a number of rotations we want it overshoots.

Does it overshoot and stay overshot, or does it overshoot and come back to the desired position?

We could use a PID loop to account for the overshooting

If not PID, what kind of controller are you presently using (that overshoots)?

Anyone know a way we can control speed during the position closed loop?

Yes, but please first clarify what you are presently doing.

Sorry for the ambiguity.

1.) Right now it’s just a P loop executing in the talon. (So we could start trying to tune the loop but then I noticed we were moving extremely fast)

2.) We get oscillations around the set point and (because there is no I value yet, we stay oscillating for a while)

3.) Really bad contextualizing on my part (sorry again). We just have the P value right now and that works well enough to get us to the set point I am just worried about the speed our bot is traveling at.

This is a large and interesting topic. Given what you have described so far, the easiest solution is probably investigating the motion magic mouse of the talons.

The crux of the issue is dealing with the momentum of your robot. The motion magic control handles this with a motion profile. You can try and manage it with a D term, but using the talons is easier.

Sent from my iPhone using Tapatalk

Thanks! I’m looking at it now and Motion Magic seems to be exactly what I need.

Using the ‘D’ term actually is probably the easiest solution. Figure out your units and choose your derivative gain term (Kd) such that Kd*maxVelDes is about equal to the maximum proportional component.

If you want to get a bit fancier, you can choose to ignore this derivative component until you are some distance from goal.

You could add logic around your proportional controller to restrict motor control if your velocity exceeds desired: if(velocity>maxVelocity) then effort = boundedEffort.

I’d recommend just going to PD because what you’re really trying to do is prevent overshoot, not limit speed.

Edit: sorry, bad reading on my part. You are directly trying to limit speed

If you want your autonomous to run slower, a quick way might be to just limit the talon output voltage in auto. Less power obviously but it may not matter if it is just auto. The method (in Java at least) is configPeakOutputVoltage(maxOutput, minOutput). Unit is volts (out of 12V).

Edit. I would agree with earlier comments about using motion magic over a position loop - we used it this year and it is so smooth (makes your autonomous look very world class). Tuning isn’t too hard and the software reference manual has a great tutorial.