Java 类edu.wpi.first.wpilibj.templates.subsystems.Shooter 实例源码

项目:2013-code-v2    文件:CommandBase.java   
public static void init() {
    // This MUST be here. If the OI creates Commands (which it very likely
    // will), constructing it during the construction of CommandBase (from
    // which commands extend), subsystems are not guaranteed to be
    // yet. Thus, their requires() statements may grab null pointers. Bad
    // news. Don't move it.

    driveTrain = new DriveTrain();
    shooter = new Shooter();
    vision = new Vision();

    pitch = new Pitch();
    trigger = new Trigger();
    loader1 = new Loader1();
    loader2 = new Loader2();

    //leave oi at the bottom and apart from the other initialized things
    //if it is initialized before the subsytems, it throws some null pointer exceptions
    //those are not fun
    //please leave it here
    oi = new OI();
    // Show what command your subsystem is running on the SmartDashboard
    SmartDashboard.putData(exampleSubsystem);
}
项目:293-2013    文件:Spike.java   
/**
 * Code here loops every 20 milliseconds during the autonomous period. While
 * loops should not be used. Everything is nice and tidy compared to last
 * year... Pieces of the robot are written in separate classes for ease of
 * reading and troubleshooting.
 */
public void teleopPeriodic() {
    OI.driveRobot(); //Drive control
    OI.controlClimb(); //Initiate climb button
    Shooter.calculateRPM();  //Constantly calculate the RPM
    //These things can only move before climbing has begun.  Once you hit the climbing button, there's no going back.  
    if (OI.beginClimb == false) {
        Shooter.runShooter(); //Adjusts the shooter PWM value accordly depending on the RPM
        OI.controlAutoAim(); //Button that starts autoAiming
        OI.controlFeed(); //Button that toggles feed
        OI.controlTrigger(); //Button that controls the trigger
        OI.controlWinch(); //Button that controls the winch.  Only used to initialize the robot before a match.  
    }

    runSmartDashboard(); //Constantly sends diagnostic information from the robot to the DriverStation
    LCD.updateLCD(); //Updates LCD so that we have feedback on what is happening.  Only one is needed per periodic loop.  
}
项目:293-2013    文件:Spike.java   
/**
 * SmartDashboard is used to send diagnostic information back to the
 * DriverStation here.
 */
private static void runSmartDashboard() {
    SmartDashboard.putNumber("Shooter Angle: ", Angle.angleEncoder.getDistance()); //Should be very accurate.  
    SmartDashboard.putNumber("Shooter RPM: ", Shooter.currentRPM); //line plot :D
    SmartDashboard.putBoolean("RPM Status: ", Shooter.shooterStatus()); //Big green/red square on the smartdashboard. 
    SmartDashboard.putNumber("Shooter PWM Value: ", Shooter.shooterPWM1.getSpeed()); //Diagnostic information.  Not really important to the driver
    SmartDashboard.putBoolean("Auto Limit", autonomousSwitch.get());
    SmartDashboard.putBoolean("Front Limit", DriveTrain.frontLimit.get()); //Not really used.
    SmartDashboard.putNumber("Timer", timer.get());
    SmartDashboard.putNumber("Target Angle", Vision.calculateAngle());
    if (initEmergencyConstantValue){
    SmartDashboard.putNumber("EMERGENCY CORRECTION VALUE", Vision.emergencyCorrectionValue);
    initEmergencyConstantValue=false;
    }

}
项目:293-2013    文件:Spike.java   
/**
     * Code here runs once when the robot starts. While loops should only be
     * used here.
     */
    public void robotInit() {
        //Initialize angle and shooter
        Angle.angleInit();
        Shooter.shooterInit();
//        //start and reset the timer
        timer.start();
        timer.reset();
//        //Clear the LCD
        LCD.updateLCD();
    }
项目:293-2013    文件:Spike.java   
/**
 * Code here loops every 20 milliseconds during the autonomous period. While
 * loops should not be used.
 */
public void autonomousPeriodic() {
    Shooter.calculateRPM(); //Constantly calculates the rpm
    Shooter.runShooter(); //Adjusts the shooter PWM value accordly depending on the RPM
    if (timer.get() < 8) { //Fire Frisbees for the first 8 seconds
        DriveTrain.tankDrive(0, 0);
        //Gets current robot location from switch on robot
        if (autonomousSwitch.get() == false) {
            Angle.setAngle(centerShotAngle);
        } else {
            Angle.setAngle(sideShotAngle);
        }
        //When the angle is set, fire the Frisbees
        if (AutoCenter.isAutoAimDone() == true) {
            readyToFire = true;
        } else {
            readyToFire = false;
        }
        Shooter.fireShooter(readyToFire);
    } else if (timer.get() < 8.5) { //Back up the robot after 8 seconds for 0.5 seconds
        DriveTrain.tankDrive(0.7, 0.7);
    } else if (timer.get() < 10.5) { //Rotate the robot after 8.5 seconds for 2 seconds
        DriveTrain.rotateDrive(0.5);
    } else { //Stop the robot after 10.5 seconds
        DriveTrain.tankDrive(0, 0);
        LCD.println(DriverStationLCD.Line.kUser6, 1, ",");
    }

    //For testing purposes
    if (timer.get() > 15) { //Resets the timer every 15 seconds
        timer.reset();
    }

    runSmartDashboard(); //Constantly sends diagnostic information from the robot to the DriverStation
    LCD.updateLCD(); //Updates LCD so that we have feedback on what is happening.  Only one is needed per periodic loop.  
}