Thread: CANJaguar
View Single Post
  #8   Spotlight this post!  
Unread 22-01-2012, 15:20
kingkurry kingkurry is offline
Registered User
FRC #4067
 
Join Date: Jan 2012
Location: Maryland
Posts: 20
kingkurry is an unknown quantity at this point
Re: CANJaguar

Quote:
Originally Posted by nickpeq View Post
If the code isn't working, try removing the slot number. Instantiate your Jaguars with only the PWM number. Also, I've never used "SpeedController x = new Jaguar(etc)". I believe I always use "Jaguar x = new Jaguar(blah)"... If that makes any difference.
And the dashboard is just like that. No real significance. It changes color only for button-presses.
I just tried instantiating the jaguars without a slot number. This didn't work either. This is the code I have been trying. I have also tried all the code that I commented out, still without results

Code:
package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Watchdog;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Jaguar;

public class RobotTemplate extends IterativeRobot {
    RobotDrive robot;
    Joystick left;
    Joystick right; 
    Jaguar leftFront;
    Jaguar leftRear;
    Jaguar rightFront;
    Jaguar rightRear;
    
    public void robotInit() {
        Jaguar leftFront = new Jaguar(1);
        Jaguar leftRear= new Jaguar(2);
        Jaguar rightFront= new Jaguar(3);
        Jaguar rightRear= new Jaguar(4);
        
        robot = new RobotDrive(leftFront,leftRear,rightFront,rightRear);
  
        //robot = new RobotDrive(1,2,3,4);
        left = new Joystick(1);
        right = new Joystick(2);
        System.out.println("RobotInit() completed.\n");
    }
    
    public void disabledContinuous(){
        leftFront.set(1);
        //robot.tankDrive(1,1);
        
        
    }
    
    public void disabledPeriodic(){
        leftFront.set(1);
        //robot.tankDrive(1,1);
    }

    public void autonomousPeriodic() {
        leftFront.set(1);
        //robot.tankDrive(1,1);

    }
    
    public void teleopContinuous(){
        leftFront.set(1);
        //robot.tankDrive(1,1);
    }

    public void teleopPeriodic() {
        //robot.tankDrive(left.getThrottle(),(-1*right.getThrottle()));
        leftFront.set(1);
        //rightFront.set(right.getMagnitude());
        //robot.tankDrive(leftFront.get(), rightFront.get());
        
        //robot.tankDrive(left, right);
        //robot.tankDrive(1,1);
       
        
        //System.out.println("left:"+left.getThrottle());
        //System.out.println("right:"+right.getThrottle());
        //System.out.println("LMAG:"+ left.getMagnitude());
        //System.out.println("RMAG:"+ right.getMagnitude());
        //System.out.println("LRAD"+left.getDirectionDegrees());
        //System.out.println("RRAD"+right.getDirectionDegrees());
        
        System.out.println("Tank Drive");
    }
    
}
As you can see, I have tried to create a robot drive specifying the pwm outputs, then driving it with tankDrive(2,2)

I have also tried creating jaguar objects and setting their speed manually. Again this did not work.

I even took a multimeter to my sidecar, testing each of the signal pins in both the 3 pin PWM and the 3 pin Digital I/O. No matter what code I tried, the signal pins never presented any current.

What do you guys think the problem could be? My code looks fine right? Could it be the ribbon cable connecting the cRIO to the sidecar?
Reply With Quote