Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   CAN (http://www.chiefdelphi.com/forums/forumdisplay.php?f=185)
-   -   Sync Two Jags (http://www.chiefdelphi.com/forums/showthread.php?t=91130)

Talguy 02-07-2011 08:38 AM

Sync Two Jags
 
How can I get two jaguars to sync together their PIDs when I only have one encoder. Should I have it that the one jag w/ encoder sens their voltage ramp to the jag without an encoder. How are other teams doing it?

Joe Ross 02-07-2011 09:23 AM

Re: Sync Two Jags
 
The following thread has some ideas, but no resolution. http://www.chiefdelphi.com/forums/sh...ad.php?t=89282 When you get it working, be sure to let people know how you did it.

kamocat 02-07-2011 09:57 AM

Re: Sync Two Jags
 
You can try using one in %Vbus, Vcomp, or Current mode, feeding it the value you've gotten from the controlling Jaguar.
For any of these options, you'll want to do some processing to the data to get something acceptable. The trouble is, for low speeds the Jaguars like to return lots of zeros. (though perhaps my PID is tuned a little too high) When you tell a Jaguar in %Vbus or Vcomp to go "0", it doesn't ramp down, it just stops. This leads to very jerky movement. Perhaps a running average of the last 5 samples would work, or perhaps you just want to ignore all the zeros.

In Current Mode, the main issue is simply lack of accuracy. It's +-2 Amps below 8A, and +-1A above. That means you better have a pretty big load in order to use it. However, large loads are usually where the double motor is necessary.

I'm planning on wiring the encoder to both motors, and having the PID independent. Because both Jaguars are subject to the same conditions, I'm hoping I won't get significant integral windup. (Also, the integral is reset when the Jaguar output is "0")

Talguy 02-07-2011 10:33 AM

Re: Sync Two Jags
 
Quote:

Originally Posted by kamocat (Post 1017512)
You can try using one in %Vbus, Vcomp, or Current mode, feeding it the value you've gotten from the controlling Jaguar.
For any of these options, you'll want to do some processing to the data to get something acceptable. The trouble is, for low speeds the Jaguars like to return lots of zeros. (though perhaps my PID is tuned a little too high) When you tell a Jaguar in %Vbus or Vcomp to go "0", it doesn't ramp down, it just stops. This leads to very jerky movement. Perhaps a running average of the last 5 samples would work, or perhaps you just want to ignore all the zeros.

In Current Mode, the main issue is simply lack of accuracy. It's +-2 Amps below 8A, and +-1A above. That means you better have a pretty big load in order to use it. However, large loads are usually where the double motor is necessary.

I'm planning on wiring the encoder to both motors, and having the PID independent. Because both Jaguars are subject to the same conditions, I'm hoping I won't get significant integral windup. (Also, the integral is reset when the Jaguar output is "0")

Is it possible to wire one encoder to two jags?

kamocat 02-07-2011 10:59 AM

Re: Sync Two Jags
 
Yes, but you have to make a splitter for it.
Make sure to not wire the two 3v power supplies together, but connecting just their - terminal should be fine.

The way I was planning on doing it was taking a prototype board (5x3) and vertical 0.1" headers, and soldering across. That way, I could just take the encoder in its current configuration, plug it into the board, and have two adapter cables, one for each Jaguar.
It's also possible to have a board that plugs directly into one of the Jaguars, but that's a little harder to make.

Talguy 02-07-2011 11:18 AM

Re: Sync Two Jags
 
ok I could just use an old PWM splitter cable

Alan Anderson 02-07-2011 11:26 AM

Re: Sync Two Jags
 
Quote:

Originally Posted by Talguy (Post 1017548)
ok I could just use an old PWM splitter cable

Not exactly. Quadrature encoders have more than three connections.

Talguy 02-07-2011 12:08 PM

Re: Sync Two Jags
 
Quote:

Originally Posted by Alan Anderson (Post 1017554)
Not exactly. Quadrature encoders have more than three connections.

yea our's has four connections but I can type them both to a common ground and 5v supply. The A&B channels will be split to the jags

techhelpbb 02-07-2011 02:56 PM

Re: Sync Two Jags
 
We split the encoder like this.

A to both.
B to both.
GND to both.
VSupply from only one.

Don't connect the supplies together unless you diode OR them and if you do that use germanium diodes for the low voltage drop across the junction.

We had a little discussion amongst ourselves about how this shouldn't work, but given we've driven the Victor 884s unmatched into CIM gear boxes with a mere gear dividing the 2 output shafts, and given there's reverse protection on both the Jaguars and Victors (in case something turns into a generator) the risks are low.

There is a chance that one Jaguar might drive more of the mechanism load than the other, as they are able to spin each other's armature like this. It shouldn't be too much of a problem and when the load on the mechanism increases they should both start to contribute. This will make tuning them interesting considering that effectively they are both in a state of semi-permanent runaway.

Only thing I will warn you about...we did this for a velocity set point...not position (haven't thought about it the other way) and I strongly advise you to have a single harness handy in case someone thinks the split harness is causing your issues.

Mr. Lim 02-07-2011 09:12 PM

Re: Sync Two Jags
 
Hook up your encoder to you "master" Jags only. Put your "slave" Jags into absolute Voltage mode.

In your TeleOp Continuous loop, do:

slaveJag.setX(masterJag.getVoltage());

kamocat 02-07-2011 10:58 PM

Re: Sync Two Jags
 
Mr. Lim, have you tried this?
I had little success in LabVIEW.
http://www.chiefdelphi.com/forums/sh...5&postcount=10

Mr. Lim 02-08-2011 10:16 PM

Re: Sync Two Jags
 
Quote:

Originally Posted by kamocat (Post 1018115)
Mr. Lim, have you tried this?
I had little success in LabVIEW.
http://www.chiefdelphi.com/forums/sh...5&postcount=10

We have tried this, and anecdotally we are having success, in that we are able to get our robot to drive at the desired speeds, with what APPEAR to be balanced output from both. I haven't scoped, or otherwise recorded, or graphed the values, and our slave Jags appear to run in virtual lock-step with the master Jags.

We are using Java, and I'm wondering if there could be a difference in the implementation between languages, or the fact that we're passing the output voltage (i.e. -12V to 12V) from the master Jaguars to the slaves, and those output voltage values might be filtered to provide a meaningful value (i.e. not an instantaneous %Vbus).

AustinSchuh 02-08-2011 10:34 PM

Re: Sync Two Jags
 
Quote:

Originally Posted by kamocat (Post 1017512)
I'm planning on wiring the encoder to both motors, and having the PID independent. Because both Jaguars are subject to the same conditions, I'm hoping I won't get significant integral windup. (Also, the integral is reset when the Jaguar output is "0")

Warning: I haven't tested this or tried to model it, but it should work in theory... Of course, the devil is in the details.

Try wrapping a control loop around the two control loops on the Jaguars to sync their voltages up. The pseudo code would be something like the following, and you can make it more complicated if the nieve implementation doesn't work. This is assuming that you are sampling the voltages of the two jaguars at the same time, and I'm not sure how much a difference in sample time between the two jaguars would effect things. Probably depends on how aggressive you are trying to sync the two.

Code:

v1 = jag1.getVoltage()
v2 = jag2.getVoltage()

error = (v1 - v2)

jag1.setX(goal - error * Kp)
jag2.setX(goal + error * Kp)

The basic idea is that you wrap a proportional loop around the two PID loops running on the jaguars in order to drive the voltage error between the two loops to 0. This should cause them to provide the same voltage to the two motors, and share the load nicely. It might also work if you try to drive the errors in the current that the two motors are drawing to 0, or something clever like that.

kamocat 02-08-2011 11:09 PM

Re: Sync Two Jags
 
Quote:

Originally Posted by AustinSchuh (Post 1018839)
Warning: I haven't tested this or tried to model it, but it should work in theory... Of course, the devil is in the details.

Try wrapping a control loop around the two control loops on the Jaguars to sync their voltages up. The pseudo code would be something like the following, and you can make it more complicated if the nieve implementation doesn't work. This is assuming that you are sampling the voltages of the two jaguars at the same time, and I'm not sure how much a difference in sample time between the two jaguars would effect things. Probably depends on how aggressive you are trying to sync the two.

Code:

v1 = jag1.getVoltage()
v2 = jag2.getVoltage()

error = (v1 - v2)

jag1.setX(goal - error * Kp)
jag2.setX(goal + error * Kp)

The basic idea is that you wrap a proportional loop around the two PID loops running on the jaguars in order to drive the voltage error between the two loops to 0. This should cause them to provide the same voltage to the two motors, and share the load nicely. It might also work if you try to drive the errors in the current that the two motors are drawing to 0, or something clever like that.

That's an interesting method of doing it. It would probably be best to get the %Output status, not the Vout status, because the voltage would have to be scaled down anyway.
Then again, I don't know what your "getVoltage" function does. Has it been modified to get the actual voltage, or does it return %Output?

I think it would make sense to monitor it first and see if any problems arise.

AustinSchuh 02-08-2011 11:23 PM

Re: Sync Two Jags
 
Quote:

Originally Posted by kamocat (Post 1018876)
Then again, I don't know what your "getVoltage" function does.

My "getVoltage" function returns some indicator of how much voltage the Jaguar is trying to put out. It is probably easiest to get the % Output from the Jaguar (should be [-1, 1]) and use that, but theoretically, any indicator should work. The time constant should probably be pretty slow since you don't care too much if they aren't perfectly the same and just want the two to be pretty close.


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

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