Log in

View Full Version : Odd PWM problem (Can't get full green)


AllenGregoryIV
23-07-2012, 16:56
We are having an odd problem that we have been troubleshooting for the past two days.

We can't seem to get any of our Jaguars to output a full forward voltage. They output full negative just fine when we program them to -1 but an output of 1 is about half a volt short of the battery voltage.

The jaguars aren't showing a full green LED. We have calibrated them and it's still not working.

Things we have checked
- Ran a basic program that only did PWM outputs directly
- Changed PWM ports on the Sidecar
- Changed PWM Cables
- Changed Digital Sidecar
- Changed Digital Module
- Calibrated Jaguars

We don't have any Victors to test with. I need to remember to keep one around for times like this.

We also tested with a VEX cortex but its full forward nor reverse signals were giving full battery voltage or getting the lights to stay on.

Any suggestions on what could be the problem? We are going to bring in an oscope tomorrow but we're trying to get the problem fixed today.

EricVanWyk
23-07-2012, 17:17
I'd check that the DSC is powered, and that you are using a Jaguar reference.

A mispowered DSC can 'give up' when over drawn, though I have not seen that present in this manner.

Using a Victor reference instead of a Jaguar will send a shorter pulse width for 1.0, which would be interpretted as less than 1. However, it would affect the reverse direction similarly.

The factory calibration for Jaguars should be good enough, I usually don't bother to recalibrate. Maybe you calibrated against something odd?

BigJ
23-07-2012, 17:18
Judging from the reach of things you've tried I'm assuming you've done these, but just in case you haven't: try switching batteries, and a quick cRIO reimage couldn't hurt. Are you noticing any weird behaviors on the dashboard (perhaps the Robot Code light flashing red for a split second sometimes? This happened to us once this season (after having the cRIO on for a few minutes) and would make the robot do strange things, but a reimage cleared it up.

AllenGregoryIV
23-07-2012, 17:28
I'd check that the DSC is powered, and that you are using a Jaguar reference.

A mispowered DSC can 'give up' when over drawn, though I have not seen that present in this manner.

Using a Victor reference instead of a Jaguar will send a shorter pulse width for 1.0, which would be interpretted as less than 1. However, it would affect the reverse direction similarly.

The factory calibration for Jaguars should be good enough, I usually don't bother to recalibrate. Maybe you calibrated against something odd?

Thanks Eric,
We are getting normal voltage to the sidecar and to all three power rails on the sidecar.

We definitely have a Jaguar object in our program.

I know we don't normally need to recalibrate but we have done it a few times properly and it still won't give us full forward voltage.

Judging from the reach of things you've tried I'm assuming you've done these, but just in case you haven't: try switching batteries, and a quick cRIO reimage couldn't hurt. Are you noticing any weird behaviors on the dashboard (perhaps the Robot Code light flashing red for a split second sometimes? This happened to us once this season (after having the cRIO on for a few minutes) and would make the robot do strange things, but a reimage cleared it up.

Thanks Josh,
We have used several batteries during our troubleshooting (going on 3-4 hours now).

Reimaging the cRIO is something we haven't tried, I have my team doing it now. Thanks for the advice.

AllenGregoryIV
23-07-2012, 17:39
Just did the reimage and didn't solve anything. We're hooking up CAN right now and seeing if we can at least make the Jaguars give out full forward voltage in some way.

Al Skierkiewicz
23-07-2012, 18:16
Allen,
In both controllers, the calibrate feature conforms the travel of the joysticks to the controller. The only reason that you would not receive a green following a calibrate is that the joystick is not returning to the same value at which it was calibrated. Are you using a calibrate routine in software or the full travel of the joystick when calibrating?
Now, there is always the possibility that the green LED driver is defective. Do you ever see the LED come on green? It should flash Green/RED when the calibrate mode is active. It should flash Green/Yellow when the calibrate has been successful. Remember that the Jags have a 15kHz output switching frequency and many meters will not measure accurately at that frequency. In addition, Jags generate a reverse pulse to charge the bootstrap cap when at full throttle, this will also generate some error.

Ether
23-07-2012, 19:12
We're hooking up CAN right now and seeing if we can at least make the Jaguars give out full forward voltage in some way.

If you haven't ripped out the PWM cables yet, try putting a scope on them so you can see exactly what you are actually sending to the Jags.

AllenGregoryIV
23-07-2012, 19:40
Allen,
In both controllers, the calibrate feature conforms the travel of the joysticks to the controller. The only reason that you would not receive a green following a calibrate is that the joystick is not returning to the same value at which it was calibrated. Are you using a calibrate routine in software or the full travel of the joystick when calibrating?
Now, there is always the possibility that the green LED driver is defective. Do you ever see the LED come on green? It should flash Green/RED when the calibrate mode is active. It should flash Green/Yellow when the calibrate has been successful. Remember that the Jags have a 15kHz output switching frequency and many meters will not measure accurately at that frequency. In addition, Jags generate a reverse pulse to charge the bootstrap cap when at full throttle, this will also generate some error.

Al thanks for the insights,
I would have expected the calibration to work as well, but we retried it a couple times with the same result. We know the calibration joystick is outputting -1 through 1 to the jaguars because we are watching the print statements. Even if calibration worked, it still doesn't explain how we started getting bad PWM values outputting from our control system. They used to work and we hadn't recalibrated them before this.

The lights on all 9 jaguars are blinking green for forward but none of them will give a full forward voltage even after calibration (or go solid green to indicate they are getting full forward). We didn't calibrate to the VEX controller but we may try that.

We moved our drive train back to CAN (used it previously in the year but stopped for various reasons) and we can get full forward voltage with CAN.

This problem is really baffling. I'm thinking the PWM output isn't symmetric (I'm assuming, we'll check tomorrow with an oscope). This would mean the calibration routine doesn't correct only one side to have a smaller range.

If that is true, I’m still not sure of the source of the issue. The only thing we haven't changed is the cRIO itself. (We don't have a spare).

AllenGregoryIV
23-07-2012, 19:54
If you haven't ripped out the PWM cables yet, try putting a scope on them so you can see exactly what you are actually sending to the Jags.




We're going to do this tomorrow, since it's still happening to our collector and shooter motors (though we are just using reverse on the shooter motors so they are fine).

Ether
23-07-2012, 20:05
We're going to do this tomorrow

Put a small resistor (1 to 10 ohms) in series and scope the voltage drop across it. You want to see the current waveform.

Alan Anderson
24-07-2012, 00:07
I saw this behavior on all four of the drive motor controllers on a robot at IRI. A borrowed Jaguar that was temporarily swapped in for one of them also did the same thing. Full reverse gave solid red on the LED, but full forward was still blinking green. The code was correctly calling out Jaguars for the RobotDrive object. The Jaguars were very likely using factory calibration. The robot was off the floor when I watched it, with no load to speak of on the wheels, but I thought I could see and hear a slight but distinct speed difference between full forward and full reverse (Jaguar forward was actually robot reverse on one side of the drivebase, of course).

When I noticed the odd Jaguar blinks, the team was in the process of trying to figure out a different mysterious problem, almost certainly a mechanical one. They didn't feel it was necessary at the time to try to track down what was going on with the speed control.

Gdeaver
24-07-2012, 07:07
Only thing not on the swap list is the crio to side car cable.

Al Skierkiewicz
24-07-2012, 07:10
Allen,
Since more than one Jag is showing the problem and since you perform a calibrate and get the confirmation that calibrate is complete, the only other thing that could cause this is a bad supply feeding the joysticks. Are you using wireless joysticks or a USB type? It is possible that during the calibrate procedure the joystick power is at full level but when driving more than one function, the voltage drops below the calibrated value.

AllenGregoryIV
24-07-2012, 11:34
Alan, I'm sorry you're having the same problem but I'm glad we're not the only ones now. Your issue sounds identical.

Gdeaver, good catch. I left that off the list but we did change it with a known good cable.

Al, we are watching the PWM outputs on the print lines and getting identical results. We are using USB joysticks and we don't have the problem when we move to CAN. I find it hard to believe that it's the joysticks or the program. We calibrate it the same way we test it. Thanks for the ideas though.

This afternoon we'll have a scope and I can post more results. I'm also going to try to configure them as Victor objects in the code and calibrate to that. If more than one team is having this issues I wonder if it's a problem with the cRIO image itself or somewhere in the Jaguar definition in WPILIB.

Joe Ross
24-07-2012, 12:29
This afternoon we'll have a scope and I can post more results. I'm also going to try to configure them as Victor objects in the code and calibrate to that. If more than one team is having this issues I wonder if it's a problem with the cRIO image itself or somewhere in the Jaguar definition in WPILIB.

You could try the PWM class with the setRaw method, sending values of 0 (full reverse) and 255 (full forward). The jaguar class limits the minimum value to 4 and the maximum value to 251. It may be that your jaguars are slightly out of tolerance and don't calibrate the difference away.

AllenGregoryIV
24-07-2012, 16:14
Well it looks like it's a problem with the factory calibration and today we were able to calibrate it to give full forward voltage. I'm not sure why it worked today and the past two days it didn't but whatever.

Here are the oscope outputs
Neutral Jaguar
http://dl.dropbox.com/u/58113883/chiefdelphi%20photos/Neutral%20Jaguar.bmp

Full FWD Jaguar
http://dl.dropbox.com/u/58113883/chiefdelphi%20photos/Full%20FWD%20Jaguar.bmp

Full REV Jaguar
http://dl.dropbox.com/u/58113883/chiefdelphi%20photos/Full%20REV%20Jaguar.bmp

AllenGregoryIV
24-07-2012, 16:16
Victor PWM outputs in case anyone is interested.

Neutral Victor
http://dl.dropbox.com/u/58113883/chiefdelphi%20photos/Neutral%20Victor.bmp

Full FWD Victor
http://dl.dropbox.com/u/58113883/chiefdelphi%20photos/Full%20FWD%20Victor.bmp

Full REV Victor
http://dl.dropbox.com/u/58113883/chiefdelphi%20photos/Full%20REV%20Victor.bmp

Thanks to everyone that helped diagnose this problem, still not sure why the factory calibration was ever messed up.

Ether
24-07-2012, 17:28
Here are the oscope outputs

I had not realized that the cRIO puts out 200Hz (5ms period) PWM when in Jag mode.

Can someone please confirm that this is correct operation?

EricVanWyk
24-07-2012, 18:07
I had not realized that the cRIO puts out 200Hz (5ms period) PWM when in Jag mode.

Can someone please confirm that this is correct operation?




That is correct operation. The Jaguar uses a faster and wider signal to push more updates per second with higher resolution.

Ether
24-07-2012, 18:14
That is correct operation. The Jaguar uses a faster and wider signal to push more updates per second with higher resolution.

Thanks Eric. I need to update the PWM Generator app then. I presently have the low limit set to 10ms.

EricVanWyk
24-07-2012, 18:19
It should work with fine with longer pulse windows. The frequency is unimportant, so long as it is quick enough to not trip the watchdog, and slow enough to still be legible. The width is the important factor.

Ether
24-07-2012, 18:24
It should work with fine with longer pulse windows. The frequency is unimportant, so long as it is quick enough to not trip the watchdog, and slow enough to still be legible. The width is the important factor.

Understood. But I want to mimic the cRIO's signal as closely as possible.

I forgot to ask: what period does the cRIO use for the Vic PWM signal?

Joe Ross
24-07-2012, 18:26
Understood. But I want to mimic the cRIO's signal as closely as possible.

I forgot to ask: what period does the cRIO use for the Vic PWM signal

5ms on Jaguar, 10ms on Victor, 20ms on Servo. There's some nice comments in the PWM source code.

The comment says jaguar is actually 5.05ms, but I can't view the scope plots to confirm.

Ether
24-07-2012, 18:47
5ms on Jaguar, 10ms on Victor, 20ms on Servo. There's some nice comments in the PWM source code.

The comment says jaguar is actually 5.05ms, but I can't view the scope plots to confirm.

Thanks Joe.

I've updated the app, if anyone's interested.

Available here (http://www.chiefdelphi.com/media/papers/2702).

BTW, an earlier version of this was used in June on an old Compaq DeskPro 2000 running FreeDOS 0.84 to run a Vic driving a CIM on a dynamometer. Oscilloscope traces of the waveform showed the pulse width generated by the app was accurate to within +/-0.001 milliseconds of the operator setting.