本文整理汇总了Java中edu.wpi.first.wpilibj.smartdashboard.SmartDashboard.putNumber方法的典型用法代码示例。如果您正苦于以下问题:Java SmartDashboard.putNumber方法的具体用法?Java SmartDashboard.putNumber怎么用?Java SmartDashboard.putNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.smartdashboard.SmartDashboard
的用法示例。
在下文中一共展示了SmartDashboard.putNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
protected void execute() {
double turn = 0;
if(DriveEncoders.getAbsoluteValue() > 0.3) {
double counts[] = DriveEncoders.getBothValues();
double percentage = 0;
if(counts[0] > counts[1]) {
percentage = counts[0] / counts[1];
} else {
percentage = counts[1] / counts[0];
}
turn = -Math.max(-0.2, Math.min(percentage, 0.2));
} else {
turn = 0.2;
}
Robot.driveTrain.setArcadeDriveCommand(0.5, turn);
SmartDashboard.putNumber("distanceAuton", DriveEncoders.getAbsoluteValue());
//SmartDashboard.putNumber("auton stop", (getDistance()) * (DriveEncoders.getAbsoluteValue() - getInitEncoderVal());
}
示例2: execute
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
/**
* Displays bools for in range for gears and shooting.
*/
@Override
protected void execute() {
if(Robot.ultrasonic.getDistance()<= RobotMap.gearMax){
SmartDashboard.putBoolean("Gear Distance", true);
SmartDashboard.putBoolean("Shooter Distance", false);
}else if(Robot.ultrasonic.getDistance()<= RobotMap.shootMax && Robot.ultrasonic.getDistance() >= RobotMap.shootMin){
SmartDashboard.putBoolean("Shooter Distance", true);
SmartDashboard.putBoolean("Gear Distance", false);
}else{
SmartDashboard.putBoolean("Gear Distance", false);
SmartDashboard.putBoolean("Shooter Distance", false);
}
SmartDashboard.putNumber("Distance Forward", Robot.ultrasonic.getDistance());
SmartDashboard.putNumber("Distance", Robot.driveEncoders.getLeftDistance());
SmartDashboard.putNumber("Gyro", Robot.gyro.getAngle()-10);
}
示例3: execute
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
@Override
protected void execute() {
double targetSpeed = .5* 1500;
Robot.shooter.setSetpoint(targetSpeed);
SmartDashboard.putNumber("Setpoint Set",targetSpeed);
Robot.shooter.agitate();
}
示例4: sendDataToSmartDashboard
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
@Override
public void sendDataToSmartDashboard() {
if (pdp != null) {
SmartDashboard.putNumber("Temperature", pdp.getTemperature());
//SmartDashboard.putNumber("TotalPower", pdp.getTotalPower());
// in the past, this has tended to screw up the CAN bus
// for (int i = 0; i < 16; i++) {
// SmartDashboard.putNumber("Current_" + i, pdp.getCurrent(i));
// }
}
}
示例5: setMotorPower
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
public void setMotorPower(double rightPower, double leftPower) {
motorFrontRight.set(rightPower);
motorRearRight.set(rightPower);
motorFrontLeft.set(leftPower);
motorRearLeft.set(leftPower);
SmartDashboard.putNumber("Right Encoder Distance: ", encoderRight.getDistance());
SmartDashboard.putNumber("Left Encoder Distance: ", encoderLeft.getDistance());
}
示例6: 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() {
oi = new OI();
drivetrain = new Drivetrain();
// chooser.addObject("My Auto", new MyAutoCommand());
SmartDashboard.putData("Auto mode", chooser);
SmartDashboard.putNumber("kP", 0.0);
SmartDashboard.putNumber("kI", 0.0);
SmartDashboard.putNumber("kD", 0.0);
}
示例7: angleError
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
public double angleError() {
double getAngle = gyro.getAngle();
// if (getAngle > 180)
// getAngle += -360.0;
SmartDashboard.putNumber("Gyro Angle", getAngle);
return getAngle;
}
示例8: testPeriodic
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
Robot.driveBase.EnableDriveBase();
Robot.driveBase.DriveAutonomous();
SmartDashboard.putNumber("AV Distance", RobotMap.AverageDistance);
}
示例9: isFinished
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
@Override
protected boolean isFinished() {
if (Math.abs(Robot.driveTrain.getLeftDistance()) >= Math.abs(_distanceL) &&
Math.abs(Robot.driveTrain.getRightDistance()) >= Math.abs(_distanceR)) {
table.putBoolean("Forward", false);
System.err.println("Done drive forward!");
Robot.driveTrain.percentVbusControl();
Robot.driveTrain.tankDrive(0, 0);
_leftSpeed = 0;
_rightSpeed = 0;
SmartDashboard.putNumber("LeftEncVelocity", Robot.driveTrain.getLeftSpeedEnc());
SmartDashboard.putNumber("RightEncVelocity", Robot.driveTrain.getRightSpeedEnc());
SmartDashboard.putNumber("LeftSpeed", Robot.driveTrain.getLeftSpeed());
SmartDashboard.putNumber("RightSpeed", Robot.driveTrain.getRightSpeed());
table.putNumber("_leftSpeed", _leftSpeed);
table.putNumber("_rightSpeed", _rightSpeed);
table.putNumber("_distanceLimitLeft", _distanceL);
table.putNumber("_distanceLimitRight", _distanceR);
table.putNumber("_encoderDistanceLeft", Robot.driveTrain.getLeftDistance());
table.putNumber("_encoderDistanceRight", Robot.driveTrain.getRightDistance());
return true;
} else {
return false;
}
}
示例10: execute
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
protected void execute() {
//currTime = System.currentTimeMillis();
currRightEnc = DriveEncoders.getRawRightValue();
currLeftEnc = DriveEncoders.getRawLeftValue();
/*currRightError = currRightEnc - initRightEnc;
currLeftError = currLeftEnc - initLeftEnc;
rightDeltaT = iTerm * (currTime - prevTime) * currRightError + (pTerm * (currRightError - prevRightError))/(currTime - prevTime);
currRightControl = prevRightControl + rightDeltaT;
leftDeltaT = iTerm * (currTime - prevTime) * currLeftError + (pTerm * (currLeftError - prevLeftError))/(currTime - prevTime);
currLeftControl = prevLeftControl + leftDeltaT;
prevTime = currTime;
prevRightError = currRightError;
prevLeftError = currLeftError;
*/
diffCounts = DriveEncoders.getRawEncDifference();
if (Math.abs(diffCounts) < 20 ){
Robot.driveTrain.setTankDriveCommand(.6 * speed, .6 * speed);
}
else if (diffCounts > 20){ //THIS WAS 50!!!
//Robot.driveTrain.setTankDriveCommand(.7, .5);
Robot.driveTrain.setTankDriveCommand(.5 * speed, .6 * speed);
}
else if (diffCounts < -20)
{
Robot.driveTrain.setTankDriveCommand(.6 * speed, .5 * speed);
}
if (dispCount == 10) {
System.out.println ("Right: " + currRightEnc + " Left :" + currLeftEnc + " diff: " + diffCounts + " Pixy: " + Robot.pixyValue);
dispCount = 0;
}
else {
dispCount++;
}
if (minAccel > NavX.ahrs.getWorldLinearAccelY())
minAccel = NavX.ahrs.getWorldLinearAccelY();
if (maxAccel < NavX.ahrs.getWorldLinearAccelY())
maxAccel = NavX.ahrs.getWorldLinearAccelY();
SmartDashboard.putNumber("Max Accelerometer", maxAccel);
SmartDashboard.putNumber("Min Accelerometer", minAccel);
//SmartDashboard.putNumber("distanceAuton", DriveEncoders.getAbsoluteValue());
//SmartDashboard.putNumber("auton stop", (getDistance()) * (DriveEncoders.getAbsoluteValue() - getInitEncoderVal());
}
示例11: execute
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
@Override
protected void execute() {
SmartDashboard.putNumber("New vision left", Robot.visiontracking.getVisionLeft());
SmartDashboard.putNumber("New vision right", Robot.visiontracking.getVisionRight());
}
示例12: execute
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
@Override
protected void execute() {
System.err.println("Execute drive forward distance");
// Robot.driveTrain.tankDrive(_powerLeft*1.1, _powerRight*1.05);
//if (!Robot.driveTrain.isDriveTrainPID()) {
// Robot.driveTrain.speedControl();
//}
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());
table.putNumber("_leftSpeed", _leftSpeed);
table.putNumber("_rightSpeed", _rightSpeed);
table.putNumber("_distanceLimitLeft", _distanceL);
table.putNumber("_distanceLimitRight", _distanceR);
table.putNumber("_encoderDistanceLeft", Robot.driveTrain.getLeftDistance());
table.putNumber("_encoderDistanceRight", Robot.driveTrain.getRightDistance());
if (Math.abs(Robot.driveTrain.getLeftDistance()) >= 0.5*Math.abs(_distanceL)) {
if (_leftSpeed > 0) {
_leftSpeed = 0.1;
}
if (_leftSpeed < 0) {
_leftSpeed = -0.1;
}
}
if (Math.abs(Robot.driveTrain.getRightDistance()) >= 0.5*Math.abs(_distanceR)) {
if (_rightSpeed > 0) {
_rightSpeed = 0.1;
}
if (_rightSpeed < 0) {
_rightSpeed = -0.1;
}
}
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;
}
}
示例13: log
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
@Override
public void log() {
SmartDashboard.putNumber("Ultrasonic: Left", getDistanceLeft());
SmartDashboard.putNumber("Ultrasonic: Right", getDistanceRight());
}
示例14: 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() {
// Instantiate subsystems and add to subsystem list (e.g., for logging to dashboard)
pdp = new PowerDistributionPanel();
compressor = new Compressor();
subsystemsList.add(compressor);
driveTrain = new DriveTrain();
subsystemsList.add(driveTrain);
//visionTest = null;
visionTest = new VisionTest();
subsystemsList.add(visionTest);
gate = new Gate();
subsystemsList.add(gate);
flapper = new Flapper();
subsystemsList.add(flapper);
ballShifter = new BallShifter();
subsystemsList.add(ballShifter);
ballShooter = new BallShooter();
subsystemsList.add(ballShooter);
intake = new Intake();
subsystemsList.add(intake);
climber = new Climber();
subsystemsList.add(climber);
ultrasonics = new DoubleUltrasonic();
subsystemsList.add(ultrasonics);
navx = new NavX();
subsystemsList.add(navx);
// Autonomous
chooser.addObject("AutoDriveToPeg", new AutoDriveToPeg(108));
chooser.addObject("Auto Place Gear Turn Right", new AutoPlaceGear(108, 60));
chooser.addObject("Auto Place Gear Straight", new AutoPlaceGear(108, 0));
chooser.addObject("Auto Place Gear Turn Left", new AutoPlaceGear(108, -60));
chooser.addObject("Auto Turn using Vision", new AutoTurnByVision(0));
chooser.addObject("Auto Turn To Peg", new AutoTurnToPeg());
chooser.addObject("Auto Drive Distance", new AutoDriveDistance(108, 10000));
chooser.addDefault("None", new AutoNone());
SmartDashboard.putData("Auto Mode", chooser);
// Preferences
Preferences prefs = Preferences.getInstance();
boolean driveMode = prefs.getBoolean("Drive Mode", RobotPreferences.DRIVE_MODE_DEFAULT);
SmartDashboard.putBoolean("Prefs: Drive Mode", driveMode);
SmartDashboard.putNumber("Prefs: Drive Kp", prefs.getDouble("Drive Kp", RobotPreferences.DRIVE_KP_DEFAULT));
SmartDashboard.putNumber("Prefs: Drive Ki", prefs.getDouble("Drive Ki", RobotPreferences.DRIVE_KI_DEFAULT));
SmartDashboard.putNumber("Prefs: Drive Kd", prefs.getDouble("Drive Kd", RobotPreferences.DRIVE_KD_DEFAULT));
SmartDashboard.putNumber("Prefs: Vision Kp", prefs.getDouble("Vision Kp", RobotPreferences.VISION_KP_DEFAULT));
SmartDashboard.putNumber("Prefs: Vision Ki", prefs.getDouble("Vision Ki", RobotPreferences.VISION_KI_DEFAULT));
SmartDashboard.putNumber("Prefs: Vision Kd", prefs.getDouble("Vision Kd", RobotPreferences.VISION_KD_DEFAULT));
SmartDashboard.putNumber("Prefs: Vision Update Delay", prefs.getLong("Vision Update Delay", RobotPreferences.VISION_UPDATE_DELAY_DEFAULT));
SmartDashboard.putNumber("Prefs: Turn To Peg Angle", prefs.getDouble("Turn To Peg Angle", RobotPreferences.TURN_TO_PEG_ANGLE_DEFAULT));
SmartDashboard.putNumber("Prefs: Vision Time Limit", prefs.getDouble("Auto Vision Time Limit", RobotPreferences.VISION_TIME_DEFAULT));
//Instantiate after all subsystems and preferences - or the world will die
//We don't want that, do we?
oi = new OI(driveMode);
//TODO uncomment to see subsystems on dashboard
//addSubsystemsToDashboard(subsystemsList);
ArrayList<LoggableSubsystem> tempList = new ArrayList<LoggableSubsystem>();
tempList.add(driveTrain);
addSubsystemsToDashboard(tempList);
}
示例15: autonomousPeriodic
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; //导入方法依赖的package包/类
@Override
public void autonomousPeriodic() {
//SENSORS
nvYaw = navx.getAngle();
talon1 = pdp.getCurrent(1);
//CONFIGURATION VARIABLES
SmartDashboard.putNumber("CURRENT AUTO STATE", state);
SmartDashboard.putNumber("CURRENT2_T1", talon1);
System.out.println("QUADRATURE" + encLeftDrive.get());
System.out.println("QUADRATURERight" + encRightDrive.get());
switch(autoSelected)
{
case 1:
{
centreRed();
break;
}
case 2:
{
centreBlue();
break;
}
case 3:
{
boilerRed();
break;
}
case 4:
{
boilerBlue();
break;
}
case 5:
{
retRed();
break;
}
case 6:
{
retBlue();
break;
}
case 7:
{
testAutonomous();
break;
}
default:
{
//Put default auto code here
break;
}
}
}