当前位置: 首页>>代码示例>>Java>>正文


Java LiveWindow类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.livewindow.LiveWindow的典型用法代码示例。如果您正苦于以下问题:Java LiveWindow类的具体用法?Java LiveWindow怎么用?Java LiveWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LiveWindow类属于edu.wpi.first.wpilibj.livewindow包,在下文中一共展示了LiveWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initGyro

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Initialize the gyro. Calibration is handled by calibrate().
 */
public void initGyro() {
  result = new AccumulatorResult();

  m_voltsPerDegreePerSecond = kDefaultVoltsPerDegreePerSecond;
  m_analog.setAverageBits(kAverageBits);
  m_analog.setOversampleBits(kOversampleBits);
  double sampleRate = kSamplesPerSecond * (1 << (kAverageBits + kOversampleBits));
  AnalogInput.setGlobalSampleRate(sampleRate);
  Timer.delay(0.1);

  setDeadband(0.0);

  setPIDSourceType(PIDSourceType.kDisplacement);

  UsageReporting.report(tResourceType.kResourceType_Gyro, m_analog.getChannel());
  LiveWindow.addSensor("AnalogGyro", m_analog.getChannel(), this);
}
 
开发者ID:FRC4131,项目名称:FRCStronghold2016,代码行数:21,代码来源:CustomGyro.java

示例2: init

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
public static void init() {
	driveTrainCIMRearLeft = new CANTalon(2); // rear left motor
	driveTrainCIMFrontLeft = new CANTalon(12); // 
	driveTrainCIMRearRight = new CANTalon(1);
	driveTrainCIMFrontRight = new CANTalon(11);
	driveTrainRobotDrive41 = new RobotDrive(driveTrainCIMRearLeft, driveTrainCIMFrontLeft, 
			driveTrainCIMRearRight, driveTrainCIMFrontRight);
	climberClimber = new CANTalon(3);
    c1 = new Talon(5);
    pDPPowerDistributionPanel1 = new PowerDistributionPanel(0);
    gyro = new ADXRS450_Gyro(Port.kOnboardCS0);
    c2 = new Talon(6);
    ultra = new AnalogInput(0);
    
    LiveWindow.addSensor("PDP", "PowerDistributionPanel 1", pDPPowerDistributionPanel1);
    LiveWindow.addSensor("Ultra", "Ultra", ultra);
   //  LiveWindow.addActuator("Intake", "Intake", intakeIntake);
    LiveWindow.addActuator("Climber", "Climber", climberClimber);
    LiveWindow.addActuator("RearLeft (2)", "Drivetrain", driveTrainCIMRearLeft);
    LiveWindow.addActuator("FrontLeft (12)", "Drivetrain", driveTrainCIMFrontLeft);
    LiveWindow.addActuator("RearRight (1)", "Drivetrain", driveTrainCIMRearRight);
    LiveWindow.addActuator("FrontRight (11)", "Drivetrain", driveTrainCIMFrontRight);
    LiveWindow.addActuator("Drive Train", "Gyro", gyro);
    // LiveWindow.addActuator("Shooter", "Shooter", shooter1);
}
 
开发者ID:Team4914,项目名称:2017-emmet,代码行数:26,代码来源:RobotMap.java

示例3: AutoDriveDistance

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
* 
* @param distance target distance in inches
* @param timeOut time out in milliseconds
*/
  public AutoDriveDistance(double distance, long timeOut) {
      requires(Robot.driveTrain);
      //requires(Robot.ultrasonics);
      requires(Robot.navx);

      targetDistance = distance;
      timeMax = timeOut;

      turnController = new PIDController(kP, kI, kD, Robot.driveTrain, new MyPidOutput());
      //turnController.setInputRange(-180, 180);
      turnController.setOutputRange(-maxOutputRange, maxOutputRange);
      turnController.setAbsoluteTolerance(kToleranceDistance);
      turnController.setContinuous(true);
      
      /* Add the PID Controller to the Test-mode dashboard, allowing manual  */
      /* tuning of the Turn Controller's P, I and D coefficients.            */
      /* Typically, only the P value needs to be modified.                   */
      LiveWindow.addSensor("DriveSystem", "RotateController", turnController);
  }
 
开发者ID:cyborgs3335,项目名称:STEAMworks,代码行数:25,代码来源:AutoDriveDistance.java

示例4: AutoSteerDriveToPeg

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
private AutoSteerDriveToPeg() {
    requires(Robot.driveTrain);
    //requires(Robot.ultrasonics);
    //requires(Robot.visionTest);
    requires(Robot.navx);
    
    turnController = new PIDController(kP, kI, kD, Robot.navx.getAHRS(), new MyPidOutput());
    turnController.setInputRange(-maxAbsSetpoint, maxAbsSetpoint);
    turnController.setOutputRange(-maxOutputRange, maxOutputRange);
    turnController.setAbsoluteTolerance(kToleranceDegrees);
    turnController.setContinuous(true);
    
    /* Add the PID Controller to the Test-mode dashboard, allowing manual  */
    /* tuning of the Turn Controller's P, I and D coefficients.            */
    /* Typically, only the P value needs to be modified.                   */
    LiveWindow.addSensor("DriveSystem", "RotateController", turnController);
}
 
开发者ID:cyborgs3335,项目名称:STEAMworks,代码行数:18,代码来源:AutoSteerDriveToPeg.java

示例5: AutoTurnByVision

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
* 
* @param speed forward speed is positive volts
*/
  public AutoTurnByVision(double speed) {
      requires(Robot.driveTrain);
      //requires(Robot.ultrasonics);
      requires(Robot.visionTest);
      requires(Robot.navx);

      forwardSpeed = -speed;
      turnController = new PIDController(kP, kI, kD, Robot.navx.getAHRS()/*Robot.visionTest*/, new MyPidOutput());
      turnController.setInputRange(-180, 180);
      turnController.setOutputRange(-maxOutputRange, maxOutputRange);
      turnController.setAbsoluteTolerance(kToleranceDegrees);
      turnController.setContinuous(true); // TODO is this what we want???
      
      /* Add the PID Controller to the Test-mode dashboard, allowing manual  */
      /* tuning of the Turn Controller's P, I and D coefficients.            */
      /* Typically, only the P value needs to be modified.                   */
      LiveWindow.addSensor("DriveSystem", "RotateController", turnController);
  }
 
开发者ID:cyborgs3335,项目名称:STEAMworks,代码行数:23,代码来源:AutoTurnByVision.java

示例6: ADXRS453_Gyro

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param port
 *            (the SPI port that the gyro is connected to)
 */
public ADXRS453_Gyro(SPI.Port port) {
    m_spi = new SPI(port);
    m_spi.setClockRate(3000000);
    m_spi.setMSBFirst();
    m_spi.setSampleDataOnRising();
    m_spi.setClockActiveHigh();
    m_spi.setChipSelectActiveLow();

    /** Validate the part ID */
    if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
        m_spi.free();
        m_spi = null;
        DriverStation.reportError("Could not find ADXRS453 gyro on SPI port " + port.value, false);
        return;
    }

    m_spi.initAccumulator(kSamplePeriod, 0x20000000, 4, 0x0c00000E, 0x04000000, 10, 16, true, true);

    calibrate();

    LiveWindow.addSensor("ADXRS453_Gyro", port.value, this);
}
 
开发者ID:team8,项目名称:FRC-2017-Public,代码行数:29,代码来源:ADXRS453_Gyro.java

示例7: testPeriodic

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * This function is called periodically during test mode
 */
public void testPeriodic() {
	LiveWindow.run();
	encoder.reset(); 
	imu.calibrate();
	
	
	
	SmartDashboard.putNumber("Joystick X Axis", drive.joystick.getX());
	SmartDashboard.putNumber("Joystick Y Axis", drive.joystick.getY());

	// drive.turnRight(-1*.2);

	// drive.turnRight(.2);

	/*
	 * drive.frontLeft.set(.2); drive.rearLeft.set(.2);
	 * drive.frontRight.set(-1 * .2); drive.rearRight.set(-1 * .2);
	 * SmartDashboard.putNumber("Front Left CAN", drive.frontLeft.get());
	 * SmartDashboard.putNumber("Rear Left CAN", drive.rearLeft.get());
	 * SmartDashboard.putNumber("Front Right CAN", drive.frontRight.get());
	 * SmartDashboard.putNumber("Rear Right CAN", drive.rearRight.get());
	 */
}
 
开发者ID:mtmustski,项目名称:FRC-Robotics-2016-Team-2262,代码行数:27,代码来源:Robot.java

示例8: BallGetter

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
public BallGetter() {
		
		super(1.005, 0, 0);
//		super(1.75, 0.04, 2.5);

		MAX_SPEED = getPreferencesDouble(RobotMap.PREF_BALL_GETTER_MAX_SPEED, 0.65);
		MIN_VALUE = getPreferencesDouble(RobotMap.PREF_BALL_GETTER_MIN_VALUE, .75);
		MAX_VALUE = getPreferencesDouble(RobotMap.PREF_BALL_GETTER_MAX_VAUE, 2.2);
		MAXGET_SPEED = getPreferencesDouble(RobotMap.PREF_BALL_GETTER_MAXGET_SPEED, 0.75);
		PARK_VALUE = getPreferencesDouble(RobotMap.PREF_BALL_GETTER_PARK_VALUE, .9);
		SIDE_SPEED = MAXGET_SPEED * 0.5;
		
		getPIDController().setInputRange(MIN_VALUE, MAX_VALUE);
		getPIDController().setAbsoluteTolerance(0.01);
		getPIDController().setToleranceBuffer(8);
		setSetpoint(2.1);
//		Robot.ballGetter.ballGetterPosition = 1;
		getPIDController().enable();
		LiveWindow.addActuator("BallGetter", "PIDSubsystem Controller", getPIDController());
		LiveWindow.addSensor("BallGetter", "current", RobotMap.ballGetterAngleMotor);
	}
 
开发者ID:firebears-frc,项目名称:FB2016,代码行数:22,代码来源:BallGetter.java

示例9: DefenseBuster

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
public DefenseBuster() {
		super(0.5, 0, 0);
//		super(1.50, 0.03, 5.0);

		MAX_SPEED = getPreferencesDouble(RobotMap.PREF_DEFENSE_BUSTER_MAX_SPEED, 0.8);
		MIN_VALUE = getPreferencesDouble(RobotMap.PREF_DEFENSE_BUSTER_MIN_VALUE, 2.5);
		MAX_VALUE = getPreferencesDouble(RobotMap.PREF_DEFENSE_BUSTER_MAX_VALUE, 3.9);
		PARK_VALUE = getPreferencesDouble(RobotMap.PREF_DEFENSE_BUSTER_PARK_VALUE, 2.1);

		softFuse = new SoftFuse(angleMotor, 40, 1, 2);
		
		getPIDController().setInputRange(MIN_VALUE, MAX_VALUE);
		getPIDController().setAbsoluteTolerance(0.01);
		getPIDController().setToleranceBuffer(8);
		setSetpoint(PARK_VALUE);
		softFuse.positionFuse(angleMotor.getOutputCurrent());

		getPIDController().enable();
		LiveWindow.addActuator("DefenseBuster", "PIDSubsystem Controller", getPIDController());
	}
 
开发者ID:firebears-frc,项目名称:FB2016,代码行数:21,代码来源:DefenseBuster.java

示例10: Jaguar

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param channel The PWM channel that the Jaguar is attached to. 0-9 are on-board, 10-19 are on
 *                the MXP port
 */
public Jaguar(final int channel) {
  super(channel);

  /*
   * Input profile defined by Luminary Micro.
   *
   * Full reverse ranges from 0.671325ms to 0.6972211ms Proportional reverse
   * ranges from 0.6972211ms to 1.4482078ms Neutral ranges from 1.4482078ms to
   * 1.5517922ms Proportional forward ranges from 1.5517922ms to 2.3027789ms
   * Full forward ranges from 2.3027789ms to 2.328675ms
   */
  setBounds(2.31, 1.55, 1.507, 1.454, .697);
  setPeriodMultiplier(PeriodMultiplier.k1X);
  setSpeed(0.0);
  setZeroLatch();

  HAL.report(tResourceType.kResourceType_Jaguar, getChannel());
  LiveWindow.addActuator("Jaguar", getChannel(), this);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:26,代码来源:Jaguar.java

示例11: ADXRS450_Gyro

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param port The SPI port that the gyro is connected to
 */
public ADXRS450_Gyro(SPI.Port port) {
  m_spi = new SPI(port);
  m_spi.setClockRate(3000000);
  m_spi.setMSBFirst();
  m_spi.setSampleDataOnRising();
  m_spi.setClockActiveHigh();
  m_spi.setChipSelectActiveLow();

  // Validate the part ID
  if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
    m_spi.free();
    m_spi = null;
    DriverStation.reportError("could not find ADXRS450 gyro on SPI port " + port.value,
        false);
    return;
  }

  m_spi.initAccumulator(kSamplePeriod, 0x20000000, 4, 0x0c00000e, 0x04000000, 10, 16,
      true, true);

  calibrate();

  HAL.report(tResourceType.kResourceType_ADXRS450, port.value);
  LiveWindow.addSensor("ADXRS450_Gyro", port.value, this);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:31,代码来源:ADXRS450_Gyro.java

示例12: initialize

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Initialize the Ultrasonic Sensor. This is the common code that initializes the ultrasonic
 * sensor given that there are two digital I/O channels allocated. If the system was running in
 * automatic mode (round robin) when the new sensor is added, it is stopped, the sensor is added,
 * then automatic mode is restored.
 */
private synchronized void initialize() {
  if (m_task == null) {
    m_task = new UltrasonicChecker();
  }
  final boolean originalMode = m_automaticEnabled;
  setAutomaticMode(false); // kill task when adding a new sensor
  m_nextSensor = m_firstSensor;
  m_firstSensor = this;

  m_counter = new Counter(m_echoChannel); // set up counter for this
  // sensor
  m_counter.setMaxPeriod(1.0);
  m_counter.setSemiPeriodMode(true);
  m_counter.reset();
  m_enabled = true; // make it available for round robin scheduling
  setAutomaticMode(originalMode);

  m_instances++;
  HAL.report(tResourceType.kResourceType_Ultrasonic, m_instances);
  LiveWindow.addSensor("Ultrasonic", m_echoChannel.getChannel(), this);
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:28,代码来源:Ultrasonic.java

示例13: ADXRS450_Gyro

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param port The SPI port that the gyro is connected to
 */
public ADXRS450_Gyro(SPI.Port port) {
  m_spi = new SPI(port);
  m_spi.setClockRate(3000000);
  m_spi.setMSBFirst();
  m_spi.setSampleDataOnRising();
  m_spi.setClockActiveHigh();
  m_spi.setChipSelectActiveLow();

  // Validate the part ID
  if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
    m_spi.free();
    m_spi = null;
    DriverStation.reportError("could not find ADXRS450 gyro on SPI port " + port.getValue(), false);
    return;
  }

  m_spi.initAccumulator(kSamplePeriod, 0x20000000, 4, 0x0c000000, 0x04000000,
      10, 16, true, true);

  calibrate();

  UsageReporting.report(tResourceType.kResourceType_ADXRS450, port.getValue());
  LiveWindow.addSensor("ADXRS450_Gyro", port.getValue(), this);
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:30,代码来源:ADXRS450_Gyro.java

示例14: AnalogOutput

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Construct an analog output on a specified MXP channel.
 *
 * @param channel The channel number to represent.
 */
public AnalogOutput(final int channel) {
  m_channel = channel;

  if (!AnalogJNI.checkAnalogOutputChannel(channel)) {
    throw new AllocationException("Analog output channel " + m_channel
        + " cannot be allocated. Channel is not present.");
  }
  try {
    channels.allocate(channel);
  } catch (CheckedAllocationException e) {
    throw new AllocationException("Analog output channel " + m_channel + " is already allocated");
  }

  long port_pointer = AnalogJNI.getPort((byte) channel);
  m_port = AnalogJNI.initializeAnalogOutputPort(port_pointer);

  LiveWindow.addSensor("AnalogOutput", channel, this);
  UsageReporting.report(tResourceType.kResourceType_AnalogOutput, channel);
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:25,代码来源:AnalogOutput.java

示例15: initialize

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入依赖的package包/类
/**
 * Initialize the Ultrasonic Sensor. This is the common code that initializes
 * the ultrasonic sensor given that there are two digital I/O channels
 * allocated. If the system was running in automatic mode (round robin) when
 * the new sensor is added, it is stopped, the sensor is added, then automatic
 * mode is restored.
 */
private synchronized void initialize() {
  if (m_task == null) {
    m_task = new UltrasonicChecker();
  }
  boolean originalMode = m_automaticEnabled;
  setAutomaticMode(false); // kill task when adding a new sensor
  m_nextSensor = m_firstSensor;
  m_firstSensor = this;

  m_counter = new Counter(m_echoChannel); // set up counter for this
  // sensor
  m_counter.setMaxPeriod(1.0);
  m_counter.setSemiPeriodMode(true);
  m_counter.reset();
  m_enabled = true; // make it available for round robin scheduling
  setAutomaticMode(originalMode);

  m_instances++;
  UsageReporting.report(tResourceType.kResourceType_Ultrasonic, m_instances);
  LiveWindow.addSensor("Ultrasonic", m_echoChannel.getChannel(), this);
}
 
开发者ID:trc492,项目名称:Frc2016FirstStronghold,代码行数:29,代码来源:Ultrasonic.java


注:本文中的edu.wpi.first.wpilibj.livewindow.LiveWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。