View Single Post
  #5   Spotlight this post!  
Unread 20-02-2012, 21:10
cooltext cooltext is offline
Registered User
FRC #0835
 
Join Date: Jan 2012
Location: Michigan
Posts: 32
cooltext is an unknown quantity at this point
Re: Victors not working

I attached all our code below, but the part with the motors I pasted. This is our current set up with the RobotDrive patch. Looking at all our code would probably be easier though. Thanks a ton.
What I want to do is connect all 10 victors and be able to control it with:

Code:
victor.set(value);


Code:
public class RobotTemplate extends IterativeRobot {
 
    //Victor leftBackMotor = new Victor(1,2);
    Victor rightBackMotor = new Victor(1,3);
    //Victor leftFrontMotor = new Victor(1,1);
    Victor rightFrontMotor = new Victor(1,4);
    
    //Victor topJag = new Victor(1,6);
    
    Victor bottomJag = new Victor(1);
    Victor topJag = new Victor(2);
    
    //RobotDrive drive = new RobotDrive(bottomJag, topJag);
            
    RobotDrive drivetrain = new RobotDrive(topJag, rightBackMotor, bottomJag, rightFrontMotor);
    AltPID topPID = new AltPID();
    //Joysticks
    Joystick white = new Joystick(2);
    Joystick black = new Joystick(1);
    
    public void robotInit() {
        
        topPID.RPMInit();
        topPID.setInputRange(0, 5000);
        topPID.setTolerance(15);
        
        AxisCamera.getInstance().writeCompression(20);
        AxisCamera.getInstance().writeBrightness(20);
        AxisCamera.getInstance().writeResolution(AxisCamera.ResolutionT.k640x480);
        AxisCamera.getInstance().writeColorLevel(50);
        
        drivetrain.setSafetyEnabled(false);
        drivetrain.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {

    }

    /**
     * This function is called periodically during operator control
     */
    public void teleopPeriodic(){   
        
            double rpmTop = topPID.getRPMTop();
            double rpmBottom = topPID.getRPMBottom();
            drivetrain.tankDrive(white.getY(), black.getY());
            
            SmartDashboard.putDouble("TOP Victor", topJag.get());
            SmartDashboard.putDouble("Top RPM", rpmTop);
            SmartDashboard.putDouble("Bottom RPM", rpmBottom);
            SmartDashboard.putDouble("Bottom Victor", bottomJag.get());
            
        while(white.getRawButton(3)){
            rpmTop = topPID.getRPMTop();
            rpmBottom = topPID.getRPMBottom();
            
            SmartDashboard.putDouble("TOP Victor", topJag.get());
            SmartDashboard.putDouble("Top RPM", rpmTop);
            SmartDashboard.putDouble("Bottom RPM", rpmBottom);
            SmartDashboard.putDouble("Bottom Victor", bottomJag.get());
            
            drivetrain.tankDrive(topPID.calculate(20, rpmTop), topPID.calculate(20, rpmBottom));
        }
    }
}
Attached Files
File Type: zip Roubun Rumble.zip (1.01 MB, 4 views)