當前位置: 首頁>>代碼示例>>Java>>正文


Java SmartDashboard類代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.smartdashboard.SmartDashboard的典型用法代碼示例。如果您正苦於以下問題:Java SmartDashboard類的具體用法?Java SmartDashboard怎麽用?Java SmartDashboard使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SmartDashboard類屬於edu.wpi.first.wpilibj.smartdashboard包,在下文中一共展示了SmartDashboard類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: robotInit

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
@Override
public void robotInit() {
	chassis = new Chassis();
	intake = new Intake();
	wheelintake = new wheelIntake();

	oi = new OI();
	chooser.addDefault("Default Auto", new DriveWithJoystick());
	// chooser.addObject("My Auto", new MyAutoCommand());
	SmartDashboard.putData("Auto mode", chooser);
	
	chassis.publishToSmartDashboard();
	

}
 
開發者ID:2141-Spartonics,項目名稱:Spartonics-Code,代碼行數:20,代碼來源:Robot.java

示例2: robotInit

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */
public void robotInit() {


	chooser = new SendableChooser<Command>();
	chassis = new Chassis();
	intake = new Intake();
	winch = new Winch();
//	shooter = new Shooter();
	
	oi = new OI();
	imu = new ADIS16448_IMU(ADIS16448_IMU.Axis.kX);
	pdp = new PowerDistributionPanel();
	
	chooser.addDefault("Drive Straight", new DriveStraight(73, 0.5));
	//chooser.addObject("Left Gear Curve", new LeftGearCurve());
	chooser.addObject("Left Gear Turn", new LeftGearTurn());
	//chooser.addObject("Right Gear Curve", new RightGearCurve());
	chooser.addObject("Right Gear Turn", new RightGearTurn());
	chooser.addObject("Middle Gear", new StraightGear());
	chooser.addObject("Turn in place", new TurnDegrees(60, .2));
	SmartDashboard.putData("Autonomous Chooser", chooser);
}
 
開發者ID:2141-Spartonics,項目名稱:Spartonics-Code,代碼行數:27,代碼來源:Robot.java

示例3: sendDataToSmartDashboard

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
@Override
public void sendDataToSmartDashboard() {
  // phone handles vision data for us
  SmartDashboard.putBoolean("LED_On", isLedRingOn());

  boolean gearLiftPhone = false;
  boolean boilerPhone = false;
  ConnectionInfo[] connections = NetworkTablesJNI.getConnections();
  for (ConnectionInfo connInfo : connections) {
    if (System.currentTimeMillis() - connInfo.last_update < 100) {
      if (connInfo.remote_id.equals("Android_GEAR_LIFT")) {
        gearLiftPhone = true;
      } else if (connInfo.remote_id.equals("Android_BOILER")) {
        boilerPhone = true;
      }
    }
  }

  SmartDashboard.putBoolean("VisionGearLift", gearLiftPhone);
  SmartDashboard.putBoolean("VisionGearLift_data", isGearVisionDataValid());
  SmartDashboard.putBoolean("VisionBoiler", boilerPhone);
  SmartDashboard.putBoolean("VisionBoiler_data", isBoilerVisionDataValid());
}
 
開發者ID:ligerbots,項目名稱:Steamworks2017Robot,代碼行數:24,代碼來源:Vision.java

示例4: log

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
@Override
public void log() {
	SmartDashboard.putNumber("DriveTrain: distance", getDistance());
	SmartDashboard.putNumber("DriveTrain: left distance", leftEncoder.getDistance());
	SmartDashboard.putNumber("DriveTrain: left velocity", leftEncoder.getRate());
	SmartDashboard.putNumber("DriveTrain: right distance", rightEncoder.getDistance());
	SmartDashboard.putNumber("DriveTrain: right velocity", rightEncoder.getRate());
	SmartDashboard.putNumber("DriveTrain: front right current", frontRight.getOutputCurrent());
	SmartDashboard.putNumber("DriveTrain: front right current pdp", Robot.pdp.getCurrent(12));
	SmartDashboard.putNumber("DriveTrain: front left  current", frontLeft.getOutputCurrent());
	SmartDashboard.putNumber("DriveTrain: front left  current pdp", Robot.pdp.getCurrent(10));
	SmartDashboard.putNumber("DriveTrain: back  right current", backRight.getOutputCurrent());
	SmartDashboard.putNumber("DriveTrain: back  right current pdp", Robot.pdp.getCurrent(13));
	SmartDashboard.putNumber("DriveTrain: back  left  current", backLeft.getOutputCurrent());
	SmartDashboard.putNumber("DriveTrain: back  left  current pdp", Robot.pdp.getCurrent(11));
}
 
開發者ID:cyborgs3335,項目名稱:STEAMworks,代碼行數:17,代碼來源:DriveTrain.java

示例5: sendDataToSmartDashboard

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
/**
 * Sends shooter data to smart dashboard.
 */
public void sendDataToSmartDashboard() {
  if (RobotMap.IS_ROADKILL) {
    return;
  }
  SmartDashboard.putNumber("Shooter_Master_Talon_Power",
      shooterMaster.getOutputCurrent() * shooterMaster.getOutputVoltage());
  SmartDashboard.putNumber("Shooter_Slave_Talon_Power",
      shooterSlave.getOutputCurrent() * shooterSlave.getOutputVoltage());
  SmartDashboard.putNumber("Shooter_RPM_Requested", requestedRpm);
  SmartDashboard.putNumber("Shooter_RPM_Real", getShooterRpm());
  SmartDashboard.putNumber("Shooter_PID_error", shooterMaster.getClosedLoopError());
  
  SmartDashboard.putBoolean("Shooter_Fault", shooterFault);
  SmartDashboard.putBoolean("Shooter_Master_Ok", shooterMaster.getFaultHardwareFailure() == 0);
  SmartDashboard.putBoolean("Shooter_Master_Temp_Ok",
      shooterMaster.getStickyFaultOverTemp() == 0);
  SmartDashboard.putBoolean("Shooter_Slave_Ok", shooterSlave.getFaultHardwareFailure() == 0);
  SmartDashboard.putBoolean("Shooter_Slave_Temp_Ok", shooterSlave.getStickyFaultOverTemp() == 0);
  
  SmartDashboard.putBoolean("Shooter_Master_Present", shooterMaster.isAlive());
  SmartDashboard.putBoolean("Shooter_Slave_Present", shooterSlave.isAlive());
}
 
開發者ID:ligerbots,項目名稱:Steamworks2017Robot,代碼行數:26,代碼來源:Shooter.java

示例6: execute

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
protected void execute() {
 	//figure out how close is "close enough" because it's unlikely we'll ever get to 2.5 on the dot.  Figure this out through testing
 	
 	Robot.driveTrain.setTankDriveCommand(.6, .6);
 /*	if (Robot.pixyCamera.transaction(sendBuffer, sendBuffer.length, buffer, 1))
 	{
 		pixyValue = buffer[0]  & 0xFF;
 	} */
 	SmartDashboard.putNumber("pixyXAutonAimGear", Robot.pixyValue);
 	if ((int) Robot.pixyValue > 128 && (int) Robot.pixyValue != 255) //132
 			{
 		Robot.driveTrain.setTankDriveCommand(.3, .6);
 		SmartDashboard.putString("PixyImage", "turning right");
 	}
 	else if ((int) Robot.pixyValue < 126){
Robot.driveTrain.setTankDriveCommand(.6, .3);
SmartDashboard.putString("PixyImage", "turning left");//123
 	}
 	else if (Robot.pixyValue == 255)
 		SmartDashboard.putString("PixyImage", "no image");
 
 }
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:23,代碼來源:AutonAimGear.java

示例7: shift

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
/**
 * Shifts the gearboxes up or down.
 * 
 * @param shiftType whether to shift up or down
 */
public void shift(ShiftType shiftType) {
  logger.info(String.format("Shifting, type=%s, shifter state=%s", shiftType.toString(),
      shiftingSolenoid.get().toString()));
  if (pcmPresent) {
    if (shiftType == ShiftType.TOGGLE) {
      if (shiftingSolenoid.get() == DoubleSolenoid.Value.kReverse) {
        shiftingSolenoid.set(DoubleSolenoid.Value.kForward);
        SmartDashboard.putBoolean("Drive_Shift", true);
      } else {
        shiftingSolenoid.set(DoubleSolenoid.Value.kReverse);
        SmartDashboard.putBoolean("Drive_Shift", false);
      }
    } else if (shiftType == ShiftType.UP) {
      shiftingSolenoid.set(DoubleSolenoid.Value.kForward);
      SmartDashboard.putBoolean("Drive_Shift", true);
    } else {
      shiftingSolenoid.set(DoubleSolenoid.Value.kReverse);
      SmartDashboard.putBoolean("Drive_Shift", false);
    }
  }
}
 
開發者ID:ligerbots,項目名稱:Steamworks2017Robot,代碼行數:27,代碼來源:DriveTrain.java

示例8: robotPeriodic

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
public void robotPeriodic() {
	SmartDashboard.putNumber("Pixy X value", pixyValue  );
    //SmartDashboard.putBoolean("IsIngesting", isIngesting);
 
    SmartDashboard.putNumber("Right Encoder", DriveEncoders.getRawRightValue());
    SmartDashboard.putNumber("Left Encoder", DriveEncoders.getRawLeftValue());
    SmartDashboard.putNumber("Encoder Differences", DriveEncoders.getRawEncDifference());
    
    SmartDashboard.putNumber("Accelerometer", NavX.ahrs.getWorldLinearAccelY());
    SmartDashboard.putBoolean("IMU_TP_Connected", NavX.ahrs.isConnected());
    SmartDashboard.putNumber("IMU_Yaw", NavX.ahrs.getYaw());
         
    SmartDashboard.putNumber("Left Encoder Value: ", RobotMap.driveTrainLeftFront.getEncPosition());
    SmartDashboard.putNumber("Right Encoder Value: ", RobotMap.driveTrainRightFront.getEncPosition());
    //SmartDashboard.putNumber("Compressor", RobotMap.compressor.getCompressorCurrent());	
    SmartDashboard.putNumber("Left Trigger: ", Robot.lTrigger);
    SmartDashboard.putNumber("Right Trigger: ", Robot.rTrigger);
    //SmartDashboard.putBoolean("Door Status", doorsOpen);
    SmartDashboard.putNumber("camera", Robot.camera);

}
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:22,代碼來源:Robot.java

示例9: execute

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
protected void execute() {
	System.err.println("Execute turn");
	Robot.driveTrain.tankDrive(-_leftSpeed, _rightSpeed);//negative sign for turning
	SmartDashboard.putNumber("distance traveled",
			Math.max(Robot.driveTrain.getLeftDistance(), Robot.driveTrain.getRightDistance()));
	SmartDashboard.putNumber("Distance", _distanceL);

	// theoretically, this should print out current velocity of both wheels
	SmartDashboard.putNumber("LeftEncVelocity", Robot.driveTrain.getLeftSpeedEnc());
	SmartDashboard.putNumber("RightEncVelocity", Robot.driveTrain.getRightSpeedEnc());

	SmartDashboard.putNumber("LeftSpeed", Robot.driveTrain.getLeftSpeed());
	SmartDashboard.putNumber("RightSpeed", Robot.driveTrain.getRightSpeed());		
	
	if (Math.abs(Robot.driveTrain.getLeftDistance()) >= Math.abs(_distanceL)) {
		System.err.println("Done left!");
		_leftSpeed = 0;
	}
	if (Math.abs(Robot.driveTrain.getRightDistance()) >= Math.abs(_distanceR)) {
		System.err.println("Done right!");
		_rightSpeed = 0;
	}

}
 
開發者ID:2729StormRobotics,項目名稱:StormRobotics2017,代碼行數:25,代碼來源:Turn.java

示例10: getInstance

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
public static bbShuffle getInstance()
{
	if (bs == null)
	{
		bs = new bbShuffle();
		if(bs == null)
		{
			SmartDashboard.putBoolean("BS Exists?", false);
			System.out.println("bbShuffle can't make itself. Fix it pls");
			return null;
		}
		SmartDashboard.putBoolean("BS Exists?", true);
		System.out.println("bbShuffle created itself");
		return bs;
	}
	SmartDashboard.putBoolean("BS Exists?", true);
	return bs;
}
 
開發者ID:BytingBulldogs3539,項目名稱:BBLIB,代碼行數:19,代碼來源:bbShuffle.java

示例11: OI

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

    logitech = new Joystick(0);
    
    shooterbutton = new JoystickButton(logitech, 1);
    shooterbutton.whileHeld(new shoot());


    // SmartDashboard Buttons
    SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
    SmartDashboard.putData("shoot", new shoot());

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    shootBackwardsButton = new JoystickButton(logitech, 2);
    shootBackwardsButton.whileHeld(new ShootReverse());

    LiftUPButton = new JoystickButton(logitech, 3);
    LiftReservseButton = new JoystickButton(logitech, 4);

    LiftUPButton.whileHeld(new LiftUP());
    LiftReservseButton.whileHeld(new LiftReverse());
}
 
開發者ID:Team2667,項目名稱:SteamWorks,代碼行數:24,代碼來源:OI.java

示例12: OI

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

    xBoxController = new Joystick(0);
    
    aButton = new JoystickButton(xBoxController, 1);
    bButton = new JoystickButton(xBoxController, 2);
    xButton = new JoystickButton(xBoxController, 3);
    aButton.whenPressed(new RelayOn());
    //b button operated by default command only?
    bButton.whenPressed(new AllForward());
    xButton.whenPressed(new MotorPositionCheck());
    

    // SmartDashboard Buttons
    SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
    SmartDashboard.putData("RelayOn", new RelayOn());
    SmartDashboard.putData("AllForward", new AllForward());
    SmartDashboard.putData("MotorPositionCheck", new MotorPositionCheck());
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
 
開發者ID:FRC2832,項目名稱:Practice_Robot_Code,代碼行數:22,代碼來源:OI.java

示例13: teleopInit

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
@Override
public void teleopInit() {
    VisionData.getNt().putBoolean("running", false);

    bumper.setTeam();

    gyroPID.resetGyro();

    // Zeroes joysticks at the beginning
    stickCalLeft = controls.getLeftDrive();
    stickCalRight = controls.getRightDrive();

    // Test component speeds with SmartDashboard
    SmartDashboard.putNumber("Shooter Speed", shooterSpeed);
    SmartDashboard.putNumber("Indexer Speed", indexerSpeed);
    SmartDashboard.putNumber("Intake Speed", intakeSpeed);
}
 
開發者ID:Team334,項目名稱:R2017,代碼行數:18,代碼來源:Robot.java

示例14: robotPeriodic

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
@Override
public void robotPeriodic() {
  try {
    // measure total cycle time, time we take during robotPeriodic, and WPIlib overhead
    final long start = System.nanoTime();
    logger.trace("robotPeriodic()");
    Scheduler.getInstance().run();

    long currentNanos = System.nanoTime();
    
    if (currentNanos - nanosAtLastUpdate > RobotMap.SMARTDASHBOARD_UPDATE_RATE * 1000000000) {
      allSubsystems.forEach(this::tryToSendDataToSmartDashboard);
      nanosAtLastUpdate = currentNanos;
    }
    
    SmartDashboard.putNumber("cycleMillis", (currentNanos - prevNanos) / 1000000.0);
    SmartDashboard.putNumber("ourTime", (currentNanos - start) / 1000000.0);
    prevNanos = currentNanos;
  } catch (Throwable ex) {
    logger.error("robotPeriodic error", ex);
    ex.printStackTrace();
  }
}
 
開發者ID:ligerbots,項目名稱:Steamworks2017Robot,代碼行數:24,代碼來源:Robot.java

示例15: publishToSmartDashboard

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //導入依賴的package包/類
public void publishToSmartDashboard(){
	chassis.publishToSmartDashboard();
	winch.publishToSmartDashboard();
	//shooter.publishToSmartDashboard();
	intake.publishToSmartDashboard();
	SmartDashboard.putNumber("Robot Angle", imu.getAngleX()/4);
    imu.updateTable();
	
}
 
開發者ID:2141-Spartonics,項目名稱:Spartonics-Code,代碼行數:10,代碼來源:Robot.java


注:本文中的edu.wpi.first.wpilibj.smartdashboard.SmartDashboard類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。