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

项目: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   
/**
 * 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;
    }

}
项目:MecanumDrivetrain    文件:ToggleDrive.java   
protected void initialize() {
    gyro.reset();
    DriveTrain.polarMode = !(DriveTrain.polarMode);
    if(DriveTrain.polarMode == true){
        SmartDashboard.putString("polarMode", "Polar Mode");
    }else{
        SmartDashboard.putString("polarMode", "Field Oriented");
    }
}
项目:ScraperBike2013    文件:StandardDrive.java   
/**
 *
 * @param d
 * @param j
 */
public StandardDrive(RobotDrive d, Joystick j){
    super("StandardDrive");
    DriveTrain = ScraperBike.getDriveTrain(); 
    //gyro1 = DriveTrain.getGyro1();
    requires(DriveTrain);
    Joystick = j;
    drive = d;    
}
项目:ScraperBike2013    文件:StandardDrive.java   
protected void execute() {
//        DriveTrain.getCommandLog().setInputs("" + gyro1.getAngle());
//        DriveTrain.setMetaCommandOutputs();
        //drive.arcadeDrive(Joystick1);
//TODO: if pause works, uncomment.
//        if (RobotMap.isJoystickEnabled()) {
            DriveTrain.powerDriveTrain();

            DriveTrain.arcadeDrive(Joystick);

//        }

    }
项目: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.  
}