Java Code Examples for edu.wpi.first.wpilibj.smartdashboard.SmartDashboard#putString()

The following examples show how to use edu.wpi.first.wpilibj.smartdashboard.SmartDashboard#putString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Vacuum.java    From FRC-2019-Public with MIT License 6 votes vote down vote up
@Override
public void outputTelemetry() {
    SmartDashboard.putBoolean("Vacuum: Low sensor", getLowerPressureSensor());
    SmartDashboard.putBoolean("Vacuum: High sensor", getHigherPressureSensor());

    String state = "default";
    if (mPeriodicIO.thresholdState == ThresholdState.ABOVE) {
        state = "Above";
    } else if (mPeriodicIO.thresholdState == ThresholdState.BETWEEN) {
        state = "Between";
    } else if (mPeriodicIO.thresholdState == ThresholdState.BELOW) {
        state = "Below";
    }
    SmartDashboard.putString("Vacuum: Threshold state", state);

    if (mCSVWriter != null) {
        mCSVWriter.write();
    }
}
 
Example 2
Source File: Robot.java    From FRC-2018-Public with MIT License 6 votes vote down vote up
@Override
public void autonomousInit() {
    SmartDashboard.putString("Match Cycle", "AUTONOMOUS");

    try {
        CrashTracker.logAutoInit();
        mDisabledLooper.stop();

        RobotState.getInstance().reset(Timer.getFPGATimestamp(), Pose2d.identity());

        Drive.getInstance().zeroSensors();
        mInfrastructure.setIsDuringAuto(true);

        mWrist.setRampRate(Constants.kAutoWristRampRate);

        mAutoModeExecutor.start();

        mLED.setEnableFaults(false);
        mEnabledLooper.start();

        mSuperstructure.setKickstand(true);
    } catch (Throwable t) {
        CrashTracker.logThrowableCrash(t);
        throw t;
    }
}
 
Example 3
Source File: Robot.java    From FRC-2018-Public with MIT License 6 votes vote down vote up
@Override
public void testInit() {
    SmartDashboard.putString("Match Cycle", "TEST");

    try {
        System.out.println("Starting check systems.");

        mDisabledLooper.stop();
        mEnabledLooper.stop();

        //mDrive.checkSystem();
        //mIntake.checkSystem();
        //mWrist.checkSystem();
        mElevator.checkSystem();

    } catch (Throwable t) {
        CrashTracker.logThrowableCrash(t);
        throw t;
    }
}
 
Example 4
Source File: Robot.java    From FRC-2018-Public with MIT License 6 votes vote down vote up
@Override
public void disabledPeriodic() {
    SmartDashboard.putString("Match Cycle", "DISABLED");

    try {
        outputToSmartDashboard();
        mWrist.resetIfAtLimit();
        mElevator.resetIfAtLimit();

        // Poll FMS auto mode info and update mode creator cache
        mAutoFieldState.setSides(DriverStation.getInstance().getGameSpecificMessage());
        mAutoModeSelector.updateModeCreator();

        if (mAutoFieldState.isValid()) {
            Optional<AutoModeBase> autoMode = mAutoModeSelector.getAutoMode(mAutoFieldState);
            if (autoMode.isPresent() && autoMode.get() != mAutoModeExecutor.getAutoMode()) {
                System.out.println("Set auto mode to: " + autoMode.get().getClass().toString());
                mAutoModeExecutor.setAutoMode(autoMode.get());
            }
            System.gc();
        }
    } catch (Throwable t) {
        CrashTracker.logThrowableCrash(t);
        throw t;
    }
}
 
Example 5
Source File: Robot.java    From FRC-2018-Public with MIT License 5 votes vote down vote up
@Override
public void disabledInit() {
    SmartDashboard.putString("Match Cycle", "DISABLED");

    try {
        CrashTracker.logDisabledInit();
        mEnabledLooper.stop();
        if (mAutoModeExecutor != null) {
            mAutoModeExecutor.stop();
        }

        mInfrastructure.setIsDuringAuto(true);
        Drive.getInstance().zeroSensors();
        RobotState.getInstance().reset(Timer.getFPGATimestamp(), Pose2d.identity());

        // Reset all auto mode state.
        mAutoModeSelector.reset();
        mAutoModeSelector.updateModeCreator();
        mAutoModeExecutor = new AutoModeExecutor();

        mDisabledLooper.start();

        mLED.setEnableFaults(true);
    } catch (Throwable t) {
        CrashTracker.logThrowableCrash(t);
        throw t;
    }
}
 
Example 6
Source File: Robot.java    From FRC-2018-Public with MIT License 5 votes vote down vote up
@Override
public void teleopInit() {
    SmartDashboard.putString("Match Cycle", "TELEOP");

    try {
        CrashTracker.logTeleopInit();
        mDisabledLooper.stop();
        if (mAutoModeExecutor != null) {
            mAutoModeExecutor.stop();
        }

        mAutoFieldState.disableOverride();

        mInfrastructure.setIsDuringAuto(false);
        mWrist.setRampRate(Constants.kWristRampRate);

        RobotState.getInstance().reset(Timer.getFPGATimestamp(), Pose2d.identity());
        mEnabledLooper.start();
        mLED.setEnableFaults(false);
        mInHangMode = false;
        mForklift.retract();

        mShootDelayed.update(false, Double.POSITIVE_INFINITY);
        mPoopyShootDelayed.update(false, Double.POSITIVE_INFINITY);
        mDrive.setVelocity(DriveSignal.NEUTRAL, DriveSignal.NEUTRAL);
        mDrive.setOpenLoop(new DriveSignal(0.05, 0.05));

        mKickStandEngaged = true;
        mKickStandReleased.update(true);
    } catch (Throwable t) {
        CrashTracker.logThrowableCrash(t);
        throw t;
    }
}
 
Example 7
Source File: Robot.java    From FRC-2018-Public with MIT License 5 votes vote down vote up
@Override
public void autonomousPeriodic() {
    SmartDashboard.putString("Match Cycle", "AUTONOMOUS");

    outputToSmartDashboard();
    try {

    } catch (Throwable t) {
        CrashTracker.logThrowableCrash(t);
        throw t;
    }
}
 
Example 8
Source File: SubsystemDrive.java    From PowerUp-2018 with GNU General Public License v3.0 5 votes vote down vote up
/**
     * drive code where rotation is dependent on acceleration
     * @param radius 0.00-1.00, 1 being zero radius and 0 being driving in a line
     */
    public void driveForza(Joystick joy, double ramp, double radius, double inhibitor) {
        double left = 0,
                right = 0;
        double acceleration = Xbox.RT(joy) - Xbox.LT(joy);

        setRamps(ramp);
//        if (getYAngle() > Constants.TILT_ANGLE ) {
//            leftMaster.set(ControlMode.PercentOutput, -1 * Constants.RECOVERY_SPEED);
//            rightMaster.set(ControlMode.PercentOutput, -1 * Constants.RECOVERY_SPEED);
//        } else if (getYAngle() < -1 * Constants.TILT_ANGLE){
//            leftMaster.set(ControlMode.PercentOutput, Constants.RECOVERY_SPEED);
//            rightMaster.set(ControlMode.PercentOutput, Constants.RECOVERY_SPEED);
//        } else {

            if (!reversing ? Xbox.LEFT_X(joy) < 0 : Xbox.LEFT_X(joy) > 0) {
                right = acceleration;
                left = (acceleration * ((2 * (1 - Math.abs(Xbox.LEFT_X(joy)))) - 1)) / radius;
            } else if (!reversing ? Xbox.LEFT_X(joy) > 0 : Xbox.LEFT_X(joy) < 0) {
                left = acceleration;
                right = (acceleration * ((2 * (1 - Math.abs(Xbox.LEFT_X(joy)))) - 1)) / radius;
            } else {
                left = acceleration;
                right = acceleration;
            }
//        }][\
        left = (left > 1.0 ? 1.0 : (left < -1.0 ? -1.0 : left));
        right = (right > 1.0 ? 1.0 : (right < -1.0 ? -1.0 : right));
        leftMaster.set(ControlMode.PercentOutput, leftify(left) * inhibitor * (reversing ? -1.0 : 1.0));
        rightMaster.set(ControlMode.PercentOutput, rightify(right) * inhibitor * (reversing ? -1.0 : 1.0));

        SmartDashboard.putString("Left Master", "Left Master Voltage: " + leftMaster.getBusVoltage());
        SmartDashboard.putString("Right Master", "Right Master Voltage: " + rightMaster.getBusVoltage());
    }
 
Example 9
Source File: SuctionClimbingStateMachine.java    From FRC-2019-Public with MIT License 4 votes vote down vote up
public void outputToSmartDashboard() {
    SmartDashboard.putString("Vacuum SM: State", getStateString());
}
 
Example 10
Source File: AutoModeSelector.java    From FRC-2019-Public with MIT License 4 votes vote down vote up
public void outputToSmartDashboard() {
    SmartDashboard.putString("AutoModeSelected", mCachedDesiredMode.name());
    SmartDashboard.putString("StartingPositionSelected", mCachedStartingPosition.name());
}
 
Example 11
Source File: RobotState.java    From FRC-2019-Public with MIT License 4 votes vote down vote up
public synchronized void outputToSmartDashboard() {
    SmartDashboard.putString("Robot Velocity", getMeasuredVelocity().toString());
}
 
Example 12
Source File: EndEffector.java    From FRC-2019-Public with MIT License 4 votes vote down vote up
@Override
public synchronized void outputTelemetry() {
    SmartDashboard.putString("Observed Game Piece", getGamePiece().toString());
}
 
Example 13
Source File: AutoModeSelector.java    From FRC-2018-Public with MIT License 4 votes vote down vote up
public void outputToSmartDashboard() {
    SmartDashboard.putString("AutoModeSelected", mCachedDesiredMode.name());
    SmartDashboard.putString("StartingPositionSelected", mCachedStartingPosition.name());
    SmartDashboard.putString("SwitchScalePositionSelected", mCachedSwitchScalePosition.name());
}
 
Example 14
Source File: Robot.java    From FRC-2018-Public with MIT License 4 votes vote down vote up
@Override
public void testPeriodic() {
    SmartDashboard.putString("Match Cycle", "TEST");
}
 
Example 15
Source File: AutoFieldState.java    From FRC-2018-Public with MIT License 4 votes vote down vote up
public void outputToSmartDashboard() {
    SmartDashboard.putString("FieldState OurSwitch", getOurSwitchSide() == null ? "NULL" : getOurSwitchSide().toString());
    SmartDashboard.putString("FieldState Scale", getScaleSide() == null ? "NULL" : getScaleSide().toString());
    SmartDashboard.putString("FieldState TheirSwitch", getOpponentSwitchSide() == null ? "NULL" : getOpponentSwitchSide().toString());
}