View Single Post
  #21   Spotlight this post!  
Unread 28-01-2012, 14:59
mbushroe mbushroe is offline
Registered User
FRC #2840
 
Join Date: Jan 2009
Location: Phoenix
Posts: 16
mbushroe is an unknown quantity at this point
Re: Motor speed control uning Jaguar

The larger shaft size digital encoder arrived finally, and I got it mounted. Using 2 lantern batteries, and they frequently over current/under volt and crash the Jaguar, requiring a full reset and start from scratch (Note to TI developers, please PLEASE add a save current configuration so that we don't have to reenter EVERYTHING after each reset?).

As long as there were no sudden jumps, it works on digital using the 'encoder' input. I did have to swap the motor leads. I am not sure if 'encoder inverted' would work as well. I also found that at low rpm, like below 100, the TI firmware does not handle speed measurements correctly. Each encoder pulse causes a sudden huge jump up in speed, causing the PID to immediately stop or even reverse (and cause weak batteries to under volt and crash the Jaguar), then go back to zero and let the PID integrate back up. An integration term of 0.0002 is too small to affect the output, 0.003 will ramp up a volt or two per second. With a 15Khz PWM rate, the PID equations may be run at the same speed, and long gaps of time steps with no encoder pulses confuse the firmware. Instead of measuring time between pulses to handle slow speeds, I think they are counting pulses per time period and doing some averaging. All this really means is that direct shaft connection to a drive wheel may require a VERY high line per revolution count, but high motor speeds should be ease to work with. I got up to 1700 rpm before the batteries lost it, and logging 20 times a second and it was stable to a few rpm.

The next big problem is that the WindRiver user's guide has sections for serial and I2I interface, but they are blank, no text. And looking in the code files, there are blocks for Jaguar (PWM mode only), Victor, PID (software version only), serial interface (raw interface), PWM, but nothing that uses the serial interface to control the internal PID in Jaguar. Does anyone know where there is code interface between the cRIO and the Jaguar in C++?

Mike