Quote:
Originally Posted by taichichuan
Greetings!
Could either of you guys post the C++ or Java set up commands you used for you jaguar? I understand setting the thing up in speed mode (are all of the jags in speed mode or just the one with the shaft encoder?), but the initialization sequence for setting the shaft encoder and the periodic reading portion of your code would be peachy to see. Also, from what I can see in testing, the value of the position goes from 0 to 65535 as I'm going backwards if I simply print the value as a float having unpacked it. Is this what I'm supposed to see? Or, should I hack the top 2 bytes off and cast it as a singed integer to show negative position?
TIA,
Mike
|
Mike,
We wrote our own Java code based on the C++ code which is posted at FirstForge, and while we were debugging our code an update to the Java code was also posted there. My suggestion would be to get a FirstForge account and check out the posted code.
Position is returned in 16.16 fixed point representation, i.e. take the 4 byte value and divide by 2^16. This is in full rotations, assuming that the "encoder line count" parameter was set up correctly. It should count correctly in both positive and negative direction when using a quadrature encoder.
Mike.