Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Voltage vs. PercentVbus (http://www.chiefdelphi.com/forums/showthread.php?t=102991)

dsirovica 16-02-2012 12:25

Voltage vs. PercentVbus
 
Can someone confirm/explain the difference between driving Jaguars via kPercentVbus which is a plain -1 to +1 PWM duty cycle (ie: 0.5 means 50% ON in the forward direction), and kVoltage (ie: 5 means +5V).

I assume the latter means the Jag will output an average of +5V during its PWM cycle irrespective of battery voltage (assuming it is > some minimum above 5V) (what is that minimum delta? maybe 1V?).

For the examples above that means, if the Battery is 12V, a kPercentVbus will provide an average V of 6V whereas in the second it will be 5V. This can then be an effective way (easier than PID) to provide a known power input to the motor irrespective of the varying state of the battery. So for example driving the shooter power via kVoltage would be quite predictable after calibration. May even be more predictable than fidling with a PID.

Now onto some confusing documentaion:
From:
http://javadoc.waltonrobotics.org/ed...ControllerRate

Quote:

getOutputVoltage
public double getOutputVoltage()Get the voltage being output from the motor terminals of the Jaguar.

Returns:
The output voltage in Volts.
--------------------------------------------------------------------------------

Also:
configMaxOutputVoltage
Quote:

public void configMaxOutputVoltage(double voltage)Configure the maximum voltage that the Jaguar will ever output. This can be used to limit the maximum output voltage in all modes so that motors which cannot withstand full bus voltage can be used safely.

Parameters:
voltage - The maximum voltage output by the Jaguar.
--------------------------------------------------------------------------------


This implies the output votage from the Jag is analogue not just ON/OFF???

If so then getOutputVoltage() will NOT return the average V of a PWM cycle.

Ether 16-02-2012 12:36

Re: Voltage vs. PercentVbus
 
Quote:

Originally Posted by dsirovica (Post 1128080)
...This implies the output votage from the Jag is analogue not just ON/OFF???...

Output voltage from Jag (or Victor) is always PWM.

The electronics in them do not permit analogue variation.


dyanoshak 16-02-2012 13:45

Re: Voltage vs. PercentVbus
 
Like Ether said, the output is always a PWM. However you are correct about the differences between the modes.

Percent VBus drives the output at some percentage of the input voltage. This is the most straightforward of the the various modes.

Voltage mode AKA Voltage Compensation mode will try and output a set voltage regardless of the battery voltage. It accomplishes this by varying the output PWM based on what the measured voltage on the input voltage is. For example, if you're telling the Jaguar to output 5 volts, and the battery is at 12V, the output duty cycle of the Jaguar will be ~42%. If the battery droops to 7 volts, the Jaguar will adjust the output duty cycle to ~71% to maintain an average of 5V.

-David

Ether 16-02-2012 14:34

Re: Voltage vs. PercentVbus
 
Quote:

Originally Posted by dyanoshak (Post 1128151)
Like Ether said, the output is always a PWM. However you are correct about the differences between the modes.

Yeah, I should have cross-referenced this thread in my post in my response for completeness for readers who hadn't already seen it.


dsirovica 16-02-2012 16:15

Re: Voltage vs. PercentVbus
 
Just to make sure we're all seeing things the same way:

When we say output 6 in kVoltage, there will be NO 6V measurable on the output at any point in time. I think we all agree that the output can only be in two possible states, a full ON or full OFF of the H-bridge (Full battery voltage (less MOSfet drop) or 0V). The output will look identical to a 0.5 in kPercentVbus with a battery voltage of 12V. There is no need to ADC the output, just the input Bus Voltage so that the Jag processor can compute the % duty cycle on the output.

So it is awfully missleading to read the following method description:

configMaxOutputVoltage

Quote:
public void configMaxOutputVoltage(double voltage)Configure the maximum voltage that the Jaguar will ever output. This can be used to limit the maximum output voltage in all modes so that motors which cannot withstand full bus voltage can be used safely.

Parameters:
voltage - The maximum voltage output by the Jaguar.

--------------------------------------------------------------------------------

Ether 16-02-2012 16:20

Re: Voltage vs. PercentVbus
 
Quote:

Originally Posted by dsirovica (Post 1128260)
there will be NO 6V measurable on the output at any point in time

It depends on how you measure it and what it's connected to and what you measure it with.

If it's connected to a stalled motor with a high inductance and you measure it using the DC setting of a meter which responds to average voltage, you will read 6V.


dsirovica 16-02-2012 16:32

Re: Voltage vs. PercentVbus
 
The PWM cycle is (I believe) 50KHz so a DC meter will read the average and indeed show 6V. But that is not reality. If you use a scope, in "normal" operation, you will see a 50KHz squarewave (ignoring inductance distortion for clarity) with a 50% on/off duty cycle, and the the squarewave will be between 0V and 12V. In a stalled case, depending on fuses, inductances, etc, for a CIM, you will likely see whatever the CIM windings R is over a 12V battery before the fuse blows or the Jag shuts down thermally.

Ether 16-02-2012 19:24

Re: Voltage vs. PercentVbus
 
Quote:

Originally Posted by dsirovica (Post 1128275)
The PWM cycle is (I believe) 50KHz

No, it's 15KHz (for a Jaguar) and 150Hz (for a Victor).

Quote:

so a DC meter will read the average and indeed show 6V
There's no guarantee that any given DC meter will read average. A true RMS DC voltmeter will read 8.5 volts. Some DC voltmeters read RMS, some read algebraic average, and some read neither.


Quote:

But that is not reality. If you use a scope, in "normal" operation, you will see a 50KHz squarewave (ignoring inductance distortion for clarity) with a 50% on/off duty cycle
The voltage waveform you see on a scope will depend on the motor, the motor controller, and the test conditions. With high inductance motors and high PWM frequency, the stalled-rotor current waveform will be DC with slight ripple.



RufflesRidge 16-02-2012 20:27

Re: Voltage vs. PercentVbus
 
Quote:

Originally Posted by dsirovica (Post 1128260)
So it is awfully missleading to read the following method description:

configMaxOutputVoltage

Quote:
public void configMaxOutputVoltage(double voltage)Configure the maximum voltage that the Jaguar will ever output. This can be used to limit the maximum output voltage in all modes so that motors which cannot withstand full bus voltage can be used safely.

Parameters:
voltage - The maximum voltage output by the Jaguar.

While I understand your point, do you have a better name and description for the method? If you do you could attach it as a patch to a bug report in the WPILib tracker: http://firstforge.wpi.edu/sf/tracker...wpilib/tracker

dsirovica 16-02-2012 20:59

Re: Voltage vs. PercentVbus
 
OK Ether, you are going to make me work here - last time I did this was 20+yrs ago. But it is all for a great cause!

So on the DC meters - yes there are many types out there, all will generally give some approximation of average voltage. As a rule though a DC meter is not the best tools for time variable signals. An oscilloscope is generally the best tool for analogue time variable signals. All electrical/electronics engineers will use them so they are a great investment to learn to use. They are the eyes into electric circuits.

I agree the inductance is huge on a CIM and cannot be ignored. I will try and model it. I couldn't find any charts of stalled CIMs on here... But I will get the kids to play with that in the off-season it will be a great exercise!

The main Q I was after is finding out exactly what the Jag APIs do - there are ample horror stories on CD from poor people spending time figuring out their problems and a lot of those can be overcome with proper documentation - which is lacking IMHO. We should be spending time on the robot/game and not on reverse engineering the APIs and tools we use.

Specifically if anyone has the full specs on kVoltage, kPercentVbus, getOutputVoltage, configMaxOutputVoltage, and setVoltageRampRate, please post a link.

FrankJ 17-02-2012 18:07

Re: Voltage vs. PercentVbus
 
I am really mostly a mechanical guy so forgive me if this makes no sense.

The output of an unconnected jag would be a PWM square wave. Connect a motor to it, you are essentially throwing a big inductor with a little resistor in the loop? You would then have to look at it as system? Would resistance in the battery become an issue? Do have to admit the whole concept of DC & output of the jag is more of a metaphor that you are using to avoid confusing mechanical types that try to relate electricity to plumbing? After all the rate equations are the same.

Ether 17-02-2012 18:09

Re: Voltage vs. PercentVbus
 
Quote:

Originally Posted by FrankJ (Post 1128993)
Connect a motor to it, you are essentially throwing a big inductor with a little resistor in the loop?

... and a generator, if the motor is spinning.



dsirovica 18-02-2012 23:25

Re: Voltage vs. PercentVbus
 
Our robot was stripping the timing belt we wanted to use for the drivetrain and at midnight last night we decided to switch to chains... So excuse the lack of progress on the PWM vs analog Voltage. But I did do a quick model in SpiceIV and was surprised how little effect the inductor had (or how determined the battery was!). Today I threw a rig together and put a scope on it - and it too showed very little deviation from a true PWM, even after braking the CIM with my glove to a near stall.

I will do some pics etc and figure out how to post them (after we get the robot working!)

The good news is: use kVoltage - you can see (on the scope) the Jag modifying the PWM ratio as you apply load on the motor.

The bad news is that the documentation is quite missleading. Especially the
decription of the configMaxOutputVoltage method. (see quote in this thread.)

If you set kVoltage = 6V there is only Battery voltage or 0V to be seen anywhere - and the square wave is pretty square accross loads - see the pics and further detail I will post soon.

Dean

dsirovica 18-02-2012 23:29

Re: Voltage vs. PercentVbus
 
BTW - the kids were excited to see the High duration of the PWM stretch as you apply load to the motor. It was a great oportunity to teach them something - most of them have never played with an oscilosope and see what really is happening in the wires. Just seing the excitement in their eyes makes it all worth while!

dsirovica 18-02-2012 23:36

Re: Voltage vs. PercentVbus
 
To answer RuffleRidge's Q above:

There is nothing really wrong with the method names - it is the description that needs to reflect reality. Its all pretty simple - The Jag can only output ON or OFF - I even looked at their cirsuit diagram and you can see that the MOSFETS in the H-Bridge are driven by a separate chip and follwing that datasheet it can ONLY drive the H-Bridge with ON/OFF signals.


All times are GMT -5. The time now is 00:51.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi