Command Voltage without Talon SRX

I have been reading Oblarg’s drivetrain characteristics paper so I can find out kv, ka, max velocity, and max acceleration. To implement, he said to step up the voltage. How do I set the voltage without a Talon SRX?

What motor controller are you using?

VictorSP

You can “up the voltage” by just sending a higher %output to your motor controller. It won’t be perfect but it’s probably close enough for most things.

Just send a %Vbus command, and make sure you have a fully charged battery. Should be close enough for the testing.

You can make a homegrown voltage compensation (kinda). Something like this (java-ish):


void setVoltage(double desiredVoltage) {
    
    batteryVoltage = pdp.getVoltage();

    if (desiredVoltage > batteryVoltage) {
        victor.set(1.0);
    }
    else if (desiredVoltage < -1*batteryVoltage) {
        victor.set(-1.0)
    }
    else {
        victor.set(desiredVoltage/batteryVoltage);
    }

}


If the desired voltage is more than the battery can provide (in the forward or reverse direction) it will just output the max it can. For example if you command 18V and the battery is at 12.5V it’ll output 100% = 12.5V. If you command 6V and battery is 12.5V then it will command 6V/12.5V = 48%.

We used something like this in 2016 for auto because we were using Talon SR and didn’t have any encoders. I couldn’t do any rigorous testing to see if it worked but it didn’t break and was consistent enough for our purposes. You could test it with a multimeter on the output of the Victor, just unplug the motor first.

Probably being naive, but what is a %Vbus command and how can I use it?

Roughly speaking, when you give the VictorSP an input command it outputs a percent of the battery voltage it is receiving.

But I just re-read 0449’s paper and there’s a paragraph that reads:

A number of caveats apply to our suggested methodology, however. Firstly, it is absolutely crucial that some step be taken to account for “voltage sag” due to the internal resistance of the battery and resistance of the robot’s wiring. The Talon SRX motor controller offers a “closed-loop voltage compensation” option that does a fine job of accomplishing this; battery voltage monitoring via the PDP can also be used to apply the necessary correction.

… so according to that last sentence, you should use PDP voltage compensation:

Let:
Vm be the voltage you want the motor to receive;
Vc be the command you should send to the VictorSP;
Vb be the battery voltage (according to the PDP);

… then the command you send to the VictorSP should be something like this:

Vc = Vm/Vb
if(Vc>1)Vc=1;
else if(Vc<-1)Vc=-1;

which is roughly what I described in my post. CodeNinja, if you post what language you’re using for programming I can help you out with integration of the voltage compensation if you’d like.

I’m using Java. This is our code: https://github.com/codeNinjaDev/FRC-2018

feat/practicebot is the branch I’m currently working on.