View Single Post
  #3   Spotlight this post!  
Unread 09-02-2013, 15:26
gman gman is offline
Registered User
FRC #4024
 
Join Date: Jan 2013
Location: Florida
Posts: 13
gman is an unknown quantity at this point
Re: Revert Jaguar to old firmware (CAN not working)

Code for the DriveTrain class if anyone has any idea what the problem might be.

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.wpi.first.wpilibj.templates.subsystems;

import edu.wpi.first.wpilibj.CANJaguar;
import edu.wpi.first.wpilibj.can.CANTimeoutException;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.templates.RobotMap;
import edu.wpi.first.wpilibj.templates.commands.Drive;

/**
*
* @author Omega
*/
public class DriveTrain extends Subsystem {
// Put methods for controlling this subsystem
// here. Call these from Commands.
CANJaguar flj;
CANJaguar frj;
CANJaguar rlj;
CANJaguar rrj;

public void initDefaultCommand() {
//Set the default command for a subsystem here.
//setDefaultCommand(new MySpecialCommand());
setDefaultCommand(new Drive());
}

public void drive(double ly, double ry, double lx, double rx)
{
//flj.setX(ly + lx);
//frj.setX(ry - rx);b
//rlj.setX(ly - lx);
try{
System.out.println("drive is executing " + ry);
rrj.setX(ry);// + rx);
}catch(Exception e){e.printStackTrace();}
}

public DriveTrain() //throws CANTimeoutException
{

try{
//flj = new CANJaguar(RobotMap.flm, CANJaguar.ControlMode.kSpeed);
//frj = new CANJaguar(RobotMap.frm, CANJaguar.ControlMode.kSpeed);
//rlj =` new CANJaguar(RobotMap.rlm, CANJaguar.ControlMode.kSpeed);
rrj = new CANJaguar(RobotMap.rlm, CANJaguar.ControlMode.kSpeed);

//flj.configEncoderCodesPerRev(200);
//frj.configEncoderCodesPerRev(200);
//rlj.configEncoderCodesPerRev(200);
rrj.configEncoderCodesPerRev(200);

//flj.setSpeedReference(CANJaguar.SpeedReference.kNo ne);
//frj.setSpeedReference(CANJaguar.SpeedReference.kNo ne);
//rlj.setSpeedReference(CANJaguar.SpeedReference.kNo ne);
rrj.setSpeedReference(CANJaguar.SpeedReference.kNo ne);

//flj.setPID(0.4, 0, 1);
//frj.setPID(0.4, 0, 1);
//rlj.setPID(0.4, 0, 1);
rrj.setPID(0.4, 0, 1);

//flj.enableControl();
//frj.enableControl();
//rlj.enableControl();
rrj.enableControl();
}catch(Exception e){e.printStackTrace();}

}
}


Stuff is commented out for simplification (we're just trying to get one working first).
Reply With Quote