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

The following examples show how to use edu.wpi.first.wpilibj.smartdashboard.SmartDashboard#putNumber() . 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: Elevator.java    From FRC-2018-Public with MIT License 6 votes vote down vote up
@Override
public void outputTelemetry() {
    SmartDashboard.putNumber("Elevator Output %", mPeriodicIO.output_percent);
    SmartDashboard.putNumber("Elevator RPM", getRPM());
    SmartDashboard.putNumber("Elevator Current", mMaster.getOutputCurrent());
    // SmartDashboard.putNumber("Elevator Error", mMaster.getClosedLoopError(0) / kEncoderTicksPerInch);
    SmartDashboard.putNumber("Elevator Height", getInchesOffGround());
    SmartDashboard.putBoolean("Elevator Limit", mPeriodicIO.limit_switch);
    SmartDashboard.putNumber("Elevator Sensor Height", mPeriodicIO.position_ticks);

    SmartDashboard.putNumber("Elevator Last Expected Trajectory", mPeriodicIO.demand);
    SmartDashboard.putNumber("Elevator Current Trajectory Point", mPeriodicIO.active_trajectory_position);
    SmartDashboard.putNumber("Elevator Traj Vel", mPeriodicIO.active_trajectory_velocity);
    SmartDashboard.putNumber("Elevator Traj Accel", mPeriodicIO.active_trajectory_accel_g);
    SmartDashboard.putBoolean("Elevator Has Sent Trajectory", hasFinishedTrajectory());
}
 
Example 2
Source File: Drive.java    From FRC-2018-Public with MIT License 6 votes vote down vote up
@Override
public void outputTelemetry() {
    SmartDashboard.putNumber("Right Drive Distance", mPeriodicIO.right_distance);
    SmartDashboard.putNumber("Right Drive Ticks", mPeriodicIO.right_position_ticks);
    SmartDashboard.putNumber("Left Drive Ticks", mPeriodicIO.left_position_ticks);
    SmartDashboard.putNumber("Left Drive Distance", mPeriodicIO.left_distance);
    SmartDashboard.putNumber("Right Linear Velocity", getRightLinearVelocity());
    SmartDashboard.putNumber("Left Linear Velocity", getLeftLinearVelocity());

    SmartDashboard.putNumber("x err", mPeriodicIO.error.getTranslation().x());
    SmartDashboard.putNumber("y err", mPeriodicIO.error.getTranslation().y());
    SmartDashboard.putNumber("theta err", mPeriodicIO.error.getRotation().getDegrees());
    if (getHeading() != null) {
        SmartDashboard.putNumber("Gyro Heading", getHeading().getDegrees());
    }
    if (mCSVWriter != null) {
        mCSVWriter.write();
    }
}
 
Example 3
Source File: Wrist.java    From FRC-2018-Public with MIT License 6 votes vote down vote up
@Override
public synchronized void outputTelemetry() {
    SmartDashboard.putNumber("Wrist Angle", getAngle());
    SmartDashboard.putNumber("Wrist Position", getPosition());
    SmartDashboard.putNumber("Wrist Ticks", mPeriodicIO.position_ticks);
    SmartDashboard.putNumber("Wrist periodic demand", mPeriodicIO.demand);
    SmartDashboard.putBoolean("LIMR", mPeriodicIO.limit_switch);

    SmartDashboard.putNumber("Wrist RPM", getRPM());
    SmartDashboard.putNumber("Wrist Power %", mPeriodicIO.output_percent);
    SmartDashboard.putBoolean("Wrist Limit Switch", mPeriodicIO.limit_switch);
    SmartDashboard.putNumber("Wrist Last Expected Trajectory", getSetpoint());
    SmartDashboard.putNumber("Wrist Current Trajectory Point", mPeriodicIO.active_trajectory_position);
    SmartDashboard.putNumber("Wrist Traj Vel", mPeriodicIO.active_trajectory_velocity);
    SmartDashboard.putNumber("Wrist Traj Accel", mPeriodicIO.active_trajectory_acceleration_rad_per_s2);
    SmartDashboard.putBoolean("Wrist Has Sent Trajectory", hasFinishedTrajectory());
    SmartDashboard.putNumber("Wrist feedforward", mPeriodicIO.feedforward);

    if (mCSVWriter != null) {
        mCSVWriter.write();
    }

}
 
Example 4
Source File: ManualCommandDrive.java    From PowerUp-2018 with GNU General Public License v3.0 6 votes vote down vote up
protected void execute() {
    SmartDashboard.putNumber("Tilt Angle", Robot.SUB_DRIVE.getYAngle());
    SmartDashboard.putBoolean("Docked", Robot.SUB_DRIVE.docking);
    SmartDashboard.putBoolean("Reversed", Robot.SUB_DRIVE.reversing);
    SmartDashboard.putNumber("Right Encoder Inches", Robot.SUB_DRIVE.pid.getRightInches());
    SmartDashboard.putNumber("Left Encoder Inches", Robot.SUB_DRIVE.pid.getLeftInches());

	switch (Robot.SUB_DRIVE.drivetrain) {
		case ROCKET_LEAGUE:
			Robot.SUB_DRIVE.driveRLTank(OI.DRIVER, Util.getAndSetDouble("Rocket Ramp", .75), Util.getAndSetDouble("Drive Inhibitor", 1));
			break;
		case FORZA: 
			Robot.SUB_DRIVE.driveForza(OI.DRIVER, Util.getAndSetDouble("Forza Ramp", .75), Util.getAndSetDouble("Radius", 1), Util.getAndSetDouble("Drive Inhibitor", 1));
			break;
	}
}
 
Example 5
Source File: ServoMotorSubsystem.java    From FRC-2019-Public with MIT License 5 votes vote down vote up
@Override
public void outputTelemetry() {
    SmartDashboard.putNumber(mConstants.kName + ": Position (units)", mPeriodicIO.position_units);
    SmartDashboard.putBoolean(mConstants.kName + ": Homing Location", atHomingLocation());
    // synchronized (this) {
    //     if (mCSVWriter != null) {
    //         mCSVWriter.write();
    //     }
    // }
}
 
Example 6
Source File: Drive.java    From FRC-2019-Public with MIT License 5 votes vote down vote up
@Override
public void outputTelemetry() {
    SmartDashboard.putNumber("Right Drive Distance", mPeriodicIO.right_distance);
    SmartDashboard.putNumber("Right Drive Ticks", mPeriodicIO.right_position_ticks);
    SmartDashboard.putNumber("Left Drive Ticks", mPeriodicIO.left_position_ticks);
    SmartDashboard.putNumber("Left Drive Distance", mPeriodicIO.left_distance);
    // SmartDashboard.putNumber("Right Linear Velocity", getRightLinearVelocity());
    // SmartDashboard.putNumber("Left Linear Velocity", getLeftLinearVelocity());

    // SmartDashboard.putNumber("X Error", mPeriodicIO.error.getTranslation().x());
    // SmartDashboard.putNumber("Y error", mPeriodicIO.error.getTranslation().y());
    // SmartDashboard.putNumber("Theta Error", mPeriodicIO.error.getRotation().getDegrees());

    // SmartDashboard.putNumber("Left Voltage Kf", mPeriodicIO.left_voltage / getLeftLinearVelocity());
    // SmartDashboard.putNumber("Right Voltage Kf", mPeriodicIO.right_voltage / getRightLinearVelocity());

    // if (mPathFollower != null) {
    //     SmartDashboard.putNumber("Drive LTE", mPathFollower.getAlongTrackError());
    //     SmartDashboard.putNumber("Drive CTE", mPathFollower.getCrossTrackError());
    // } else {
    //     SmartDashboard.putNumber("Drive LTE", 0.0);
    //     SmartDashboard.putNumber("Drive CTE", 0.0);
    // }

    if (getHeading() != null) {
        SmartDashboard.putNumber("Gyro Heading", getHeading().getDegrees());
    }

    if (mCSVWriter != null) {
        mCSVWriter.write();
    }
}
 
Example 7
Source File: LidarProcessor.java    From FRC-2018-Public with MIT License 5 votes vote down vote up
public void addPoint(LidarPoint point, boolean newScan) {
    SmartDashboard.putNumber("LIDAR last_angle", point.angle);

    Translation2d cartesian = point.toCartesian();
    logPoint(point.angle, point.distance, cartesian.x(), cartesian.y());

    lock.writeLock().lock();
    try {
        if (newScan) { // crosses the 360-0 threshold. start a new scan
            prev_timestamp = Timer.getFPGATimestamp();

            // long start = System.nanoTime();
            // Translation2d towerPos = getTowerPosition();
            // long end = System.nanoTime();
            // SmartDashboard.putNumber("towerPos_ms", (end-start)/1000000);
            // SmartDashboard.putNumber("towerPosX", towerPos.x());
            // SmartDashboard.putNumber("towerPosY", towerPos.y());

            mScans.add(new LidarScan());
            if (mScans.size() > Constants.kChezyLidarNumScansToStore) {
                mScans.removeFirst();
            }
        }

        if (!excludePoint(cartesian.x(), cartesian.y())) {
            getCurrentScan().addPoint(new Point(cartesian), point.timestamp);
        }
    } finally {
        lock.writeLock().unlock();
    }
}
 
Example 8
Source File: RobotState.java    From FRC-2018-Public with MIT License 5 votes vote down vote up
public void outputToSmartDashboard() {
    Pose2d odometry = getLatestFieldToVehicle().getValue();
    SmartDashboard.putNumber("Robot Pose X", odometry.getTranslation().x());
    SmartDashboard.putNumber("Robot Pose Y", odometry.getTranslation().y());
    SmartDashboard.putNumber("Robot Pose Theta", odometry.getRotation().getDegrees());
    SmartDashboard.putNumber("Robot Linear Velocity", vehicle_velocity_measured_.dx);
}
 
Example 9
Source File: CheesyVision2.java    From FRC-2018-Public with MIT License 5 votes vote down vote up
@Override
public void outputTelemetry() {
    SmartDashboard.putBoolean("Connected to CheesyVision2", isConnected());
    SmartDashboard.putNumber("Desired Height (0 cubes)", getDesiredHeight(false, 0, true));
    SmartDashboard.putNumber("Desired Height (1 cube)", getDesiredHeight(false, 1, true));
    SmartDashboard.putNumber("Desired Height (2 cubes)", getDesiredHeight(false, 2, true));
}
 
Example 10
Source File: CyborgCommandDriveDistance.java    From PowerUp-2018 with GNU General Public License v3.0 5 votes vote down vote up
protected void execute() {
	DriverStation.reportWarning("DRIVING " + inches + " INCHES", false);
	SmartDashboard.putNumber("Left Encoder Inches", Robot.SUB_DRIVE.pid.getLeftInches());
	SmartDashboard.putNumber("Right Encoder Inches", Robot.SUB_DRIVE.pid.getRightInches());

    SmartDashboard.putNumber("Error", Robot.SUB_DRIVE.pid.getError());
}
 
Example 11
Source File: Looper.java    From FRC-2019-Public with MIT License 4 votes vote down vote up
public void outputToSmartDashboard() {
    SmartDashboard.putNumber("looper_dt", mDT);
}
 
Example 12
Source File: Limelight.java    From FRC-2019-Public with MIT License 4 votes vote down vote up
@Override
public synchronized void outputTelemetry() {
    SmartDashboard.putBoolean(mConstants.kName + ": Has Target", mSeesTarget);
    SmartDashboard.putNumber(mConstants.kName + ": Pipeline Latency (ms)", mPeriodicIO.latency);
}
 
Example 13
Source File: Looper.java    From FRC-2018-Public with MIT License 4 votes vote down vote up
public void outputToSmartDashboard() {
    SmartDashboard.putNumber("looper_dt", dt_);
}
 
Example 14
Source File: OI.java    From PowerUp-2018 with GNU General Public License v3.0 4 votes vote down vote up
/** assigns what every SmartDash and controller button does */
public OI() {
	/// manipulator wheels
		Button spinIn = new JoystickButton(OPERATOR, Xbox.RB);
				spinIn.whileHeld(new ButtonCommandEat());
		Button spinOut = new JoystickButton(OPERATOR, Xbox.LB);
				spinOut.whileHeld(new ButtonCommandSpit());
	/// manipulator clamp
		Button toggleClamp = new JoystickButton(OPERATOR, Xbox.A);
			toggleClamp.toggleWhenActive(new ToggleCommandClamp());
	/// candy cane
		Button toggleHook = new JoystickButton(OPERATOR, Xbox.B);
			toggleHook.toggleWhenActive(new ToggleCommandHook());
	/// drop the mast
		Button dropIt = new JoystickButton(OPERATOR, Xbox.X);
			dropIt.toggleWhenPressed(new ButtonCommandHitTheDeck());
	/// Reversing mode
		Button toggleReverse = new JoystickButton(DRIVER, Xbox.Y);
			toggleReverse.toggleWhenPressed(new ToggleCommandReverse());
	/// Docking mode
		Button toggleDock = new JoystickButton(DRIVER, Xbox.X);
			toggleDock.toggleWhenPressed(new ToggleCommandDock());
	/// To Compress, or Not To Compress. It is now an option.
		SmartDashboard.putData("Disable Compressor", new ToggleCommandKillCompressor());
		

	/// PID
		SmartDashboard.putData("Kill PID", new ToggleCommandKillPID());
		SmartDashboard.putNumber("Right Encoder Position", 0);
		SmartDashboard.putNumber("Left Encoder Position", 0);
		
	/// limit switch displays
		SmartDashboard.putBoolean("Lower Screw", true);
    	SmartDashboard.putBoolean("Upper Screw", false);
    	SmartDashboard.putBoolean("Lower Pinion", true);
    	SmartDashboard.putBoolean("Upper Pinion", false);
    	
    	SmartDashboard.putNumber("Left inches", 0);
    	SmartDashboard.putNumber("Right inches", 0);
    	
    	DriverStation.reportWarning("OI IS INSTANTIATED", false);

    /// Cyborg command testers
		SmartDashboard.putData("Drive Direct", new CyborgCommandDriveDirect(Util.getAndSetDouble("Drive Direct Power", 0)));
		SmartDashboard.putData("Drive Distance", new CyborgCommandDriveDistance(Util.getAndSetDouble("Drive Distance Inches", 0)));
		SmartDashboard.putData("Drive Until Error", new CyborgCommandDriveUntilError());
		SmartDashboard.putData("Rotate Degree", new CyborgCommandRotateDegrees(Util.getAndSetDouble("Rotate Degrees", 0)));
		SmartDashboard.putData("Spit", new CyborgCommandSpit((long)Util.getAndSetDouble("Spit Time", 500)));
		SmartDashboard.putData("Raise to Position: Pinion Up", new CyborgCommandGrow(Mast.PINION_UP));
		SmartDashboard.putData("Raise to Position: Pinion Down", new CyborgCommandGrow(Mast.PINION_DOWN));
		SmartDashboard.putData("Raise to Position: Screw Up", new CyborgCommandGrow(Mast.SCREW_UP));
		SmartDashboard.putData("Raise to Position: Screw Down", new CyborgCommandGrow(Mast.SCREW_DOWN));
}
 
Example 15
Source File: CyborgCommandRotateDegrees.java    From PowerUp-2018 with GNU General Public License v3.0 4 votes vote down vote up
protected void execute() {
    DriverStation.reportWarning("ROTATING " + (inches / SCALAR) + " DEGREES" + ((inches > 0) ? "CW" : "CCW"), false);
    SmartDashboard.putNumber("Left Encoder Inches", Robot.SUB_DRIVE.pid.getLeftInches());
    SmartDashboard.putNumber("Right Encoder Inches", Robot.SUB_DRIVE.pid.getRightInches());
    SmartDashboard.putNumber("Error", Robot.SUB_DRIVE.pid.getError());
}