Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Encoder Feedback From Jaguar (http://www.chiefdelphi.com/forums/showthread.php?t=101737)

ssirovica 01-02-2012 20:13

Encoder Feedback From Jaguar
 
Our team has decided to plug an encoder into one of our Jaguars to regulate the speed of our shooter for more accurate results.

However, we are not getting any output from the encoder.

There is potentially a hardware or software issue.

Our Code:
Initialization
PHP Code:

try {
            
rightMotor1 = new CANJaguar(11CANJaguar.ControlMode.kPercentVbus);
            
rightMotor2 = new CANJaguar(12CANJaguar.ControlMode.kPercentVbus); //Change these to id Nums of jaguar!!!!!
            
leftMotor1 = new CANJaguar(13CANJaguar.ControlMode.kPercentVbus);
            
leftMotor2 = new CANJaguar(15CANJaguar.ControlMode.kPercentVbus);
            
rightMotor2.enableControl();


        } catch (
CANTimeoutException ex) {
            
            
ex.printStackTrace();
        } 

and here is our output code
PHP Code:

try {
        
driverStation.println(DriverStationLCD.Line.kUser31"Right Encoder Jaguar: " Double.toString(rightMotor2.getSpeed()));
          } catch (
CANTimeoutException ex) {

            
ex.printStackTrace();
        } 

Hardware wise everything seems to be wired normally except the Index signal which is supposed to go into the Jaguar is left floating because our encoder does not output an Index signal.

Any ideas?

eddie12390 02-02-2012 11:27

Re: Encoder Feedback From Jaguar
 
driverStation.updateLCD() needs to be called when you want the text to show up. (Every single time println is called)

biojae 07-02-2012 02:10

Re: Encoder Feedback From Jaguar
 
Quote:

Originally Posted by ssirovica (Post 1118120)
Our team has decided to plug an encoder into one of our Jaguars to regulate the speed of our shooter for more accurate results.

However, we are not getting any output from the encoder.
There is potentially a hardware or software issue.
Hardware wise everything seems to be wired normally except the Index signal which is supposed to go into the Jaguar is left floating because our encoder does not output an Index signal.

Any ideas?



It's most likely a software issue.
You have to tell the Jaguar the reference for the encoder.
I haven't tried it, but you should be able to set it without going into speed control.
(I have only tried it in position control mode, but after the reference is set, it works until the Jag is power cycled. That includes changing modes.)

What you should try is code that is something like this:
Code:


try {
  rightMotor1 = new CANJaguar(11, CANJaguar.ControlMode.kSpeed); // on the one that has the encoder plugged into it.
  rightMotor1.configEncoderCodesPerRev(360); // change to however many counts per rev on your shooter
  rightMotor1.enableControl(); // Not sure if this line is needed
  rightMotor1.changeControlMode(CANJaguar.ControlMode.kPercentVbus); //Change back to voltage mode now that the encoder is configured
  rightMotor1.enableControl(); // From this point on, you should see a speed on your debugging statements
 
  rightMotor2 = new CANJaguar(12, CANJaguar.ControlMode.kPercentVbus);
  leftMotor1 = new CANJaguar(13, CANJaguar.ControlMode.kPercentVbus);
  leftMotor2 = new CANJaguar(15, CANJaguar.ControlMode.kPercentVbus);
           


        } catch (CANTimeoutException ex) {
           
            ex.printStackTrace();
        }


notmattlythgoe 07-02-2012 07:45

Re: Encoder Feedback From Jaguar
 
Agreed, you are missing the encoder configuration.


All times are GMT -5. The time now is 22:20.

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