SysID and Voltage Compensation

There have been some in-depth threads over the years about system identification/characterization and it’s relation to voltage compensation. I’m wondering if there are any best practices with the new SysID tool. If I use SysID with my drivetrain (4 Falcon 500’s), can I enable voltage compensation? If so, what saturation voltage would be recommended?

If your voltages are externally meaningful (i.e. you calculated them as the result of some test procedure), you should have voltage compensation turned on to ensure that you’re actually putting out the voltages you think you are.

The saturation voltage can be set to whatever you want, since ostensibly you’ll just cancel whatever voltage you pick right back out when converting to unit scale (which the CTRE API requires). The nominal battery voltage is a reasonable choice.

Thanks @Oblarg. Are there any best practices or procedures for using SysID and voltage compensation? For example, we used SysID on our launcher flywheel and we have feed forward working quite well. However, when our cargo indexer runs the battery voltage drops and our flywheel slows down briefly.

To overcome this should we run SysID analysis with a more sustainable Max Controller Voltage, say 10 volts? Then, would we enable voltage compensation on our controllers with saturation voltage of 10, and (as you pointed out) convert the feedforward to the unit scale by dividing it by 10?

The SysId analysis is orthogonal to the question of what your saturation voltage should be.

You’ll see better results with current limiting than with limiting the saturation voltage if your goal is to avoid brownouts.

Just when I think I understand, I realize I need to think harder. Let me restate and see if this makes sense.

SysId analysis is used to calculate feed forward voltage with the SimpleFeedForward class. The resulting voltage is given to the CTRE controller’s arbitrary feed forward as a percentage of the configured saturation voltage when voltage compensation is on, or as a percentage of the current battery voltage when compensation is off. So the values from SysId and the saturation voltage are separate concerns.

For an example, let’s say the result from SimpleFeedForward.calculate() is 6. With compensation on and saturation voltage of 10, I would give arbitrary feedforward of 0.6. If saturation voltage is 12, I would give arbitrary feed forward of 0.5.

Finally, if I did not have voltage compensation on I could divide the result of SimpleFeedForward.calculate() by RobotController.getBatteryVoltage() in an attempt to compensate on my own.

Now to bring it all together for how this relates to my flywheel. The original error I made was that I was dividing the result from SimpleFeedForward.calculate() by 12, but I did not have voltage compensation enabled. For example, when the battery voltage was 12v and my feed forward was 6v, an arbitrary feed forward of 0.5 was correct. However, when the battery voltage was 10v and my feed forward was 6v I was still calculating arbitrary feed forward of 0.5. The CTRE controller was then taking the current voltage of 10v and multiplying by 0.5 to get feed forward of 5v instead of 6v, causing the flywheel to slow down. (Assuming I wasn’t getting a brownout.)

2 Likes

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