View Single Post
  #5   Spotlight this post!  
Unread 22-01-2011, 22:50
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Re: setX() not working

Ok, so I set the number of ticks, and setSpeed still does not seem to work. Here's what I've written.

Code:
    CANJaguar jag;
    
    public void robotInit() {
        try {
            jag = new CANJaguar(4);
            jag.setPID(1, 1, 0);
            jag.setSpeedReference(CANJaguar.SpeedReference.kQuadEncoder);
            jag.changeControlMode(CANJaguar.ControlMode.kSpeed);
            jag.configEncoderCodesPerRev(100);
            jag.enableControl();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
Code:
    public void teleopPeriodic() {
        try {
            jag.setX(10);
            System.out.println(jag.getSpeed() + " " + jag.getOutputVoltage() +
                               " " + jag.getOutputCurrent() + " " + 
                               jag.getTemperature() + " " + jag.isAlive() +
                               " " + jag.isSafetyEnabled());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
During Current or Voltage control, the encoder reads fine. But in Speed control, no signal to drive is sent to the jaguar (light is yellow, both outputs are 0, as is the speed). Is there something I'm forgetting to set? Thanks.
Reply With Quote