Thread: Sync Two Jags
View Single Post
  #14   Spotlight this post!  
Unread 02-08-2011, 11:09 PM
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Sync Two Jags

Quote:
Originally Posted by AustinSchuh View Post
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.
__________________
-- Marshal Horn
Reply With Quote