本文整理汇总了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();
}
示例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);
}
示例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());
}
示例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));
}
示例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());
}
示例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");
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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());
}
示例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
}
示例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);
}
示例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();
}
}
示例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();
}