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


Java LiveWindow.addSensor方法代码示例

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


在下文中一共展示了LiveWindow.addSensor方法的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: 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

示例8: 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

示例9: 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

示例10: AnalogInput

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
/**
 * Construct an analog channel.
 *
 * @param channel The channel number to represent. 0-3 are on-board 4-7 are on
 *        the MXP port.
 */
public AnalogInput(final int channel) {
  m_channel = channel;

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

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

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

示例11: 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

示例12: 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

示例13: init

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    leftSideLeftPaddle = new Spark(0);
    LiveWindow.addActuator("LeftSide", "LeftPaddle", (Spark) leftSideLeftPaddle);
    
    leftSideLeftOut = new DigitalInput(0);
    LiveWindow.addSensor("LeftSide", "LeftOut", leftSideLeftOut);
    
    leftSideLeftIn = new DigitalInput(2);
    LiveWindow.addSensor("LeftSide", "LeftIn", leftSideLeftIn);
    
    rightSideRightPaddle = new Spark(1);
    LiveWindow.addActuator("RightSide", "RightPaddle", (Spark) rightSideRightPaddle);
    
    rightSideRightOut = new DigitalInput(1);
    LiveWindow.addSensor("RightSide", "RightOut", rightSideRightOut);
    
    rightSideRightIn = new DigitalInput(3);
    LiveWindow.addSensor("RightSide", "RightIn", rightSideRightIn);
    
    gearGate = new Spark(2);
    LiveWindow.addActuator("Gear", "Gate", (Spark) gearGate);
    
    gearGearIsIn = new DigitalInput(4);
    LiveWindow.addSensor("Gear", "GearIsIn", gearGearIsIn);
    

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
 
开发者ID:ElectricGeorge,项目名称:GearBot,代码行数:30,代码来源:RobotMap.java

示例14: init

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTrainLeftMotor = new Talon(0);
    LiveWindow.addActuator("DriveTrain", "LeftMotor", (Talon) driveTrainLeftMotor);
    
    driveTrainRightMotor = new Talon(1);
    LiveWindow.addActuator("DriveTrain", "RightMotor", (Talon) driveTrainRightMotor);
    
    driveTrainRobotDrive = new RobotDrive(driveTrainLeftMotor, driveTrainRightMotor);
    
    driveTrainRobotDrive.setSafetyEnabled(true);
    driveTrainRobotDrive.setExpiration(0.1);
    driveTrainRobotDrive.setSensitivity(0.5);
    driveTrainRobotDrive.setMaxOutput(1.0);

    intakeintakeMotor = new Talon(2);
    LiveWindow.addActuator("Intake", "intakeMotor", (Talon) intakeintakeMotor);
    
    pneumaticSystemCompressor = new Compressor(0);
    
    
    pneumaticSystemDoubleSolenoidPusher = new DoubleSolenoid(0, 0, 1);
    LiveWindow.addActuator("Pneumatic System", "DoubleSolenoidPusher", pneumaticSystemDoubleSolenoidPusher);
    
    sensorBaseUltraSonicMaxbotix = new AnalogInput(0);
    LiveWindow.addSensor("SensorBase", "UltraSonicMaxbotix", sensorBaseUltraSonicMaxbotix);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
 
开发者ID:newheights,项目名称:RobotBuilderTest,代码行数:30,代码来源:RobotMap.java

示例15: ADXL362

import edu.wpi.first.wpilibj.livewindow.LiveWindow; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param port  The SPI port that the accelerometer is connected to
 * @param range The range (+ or -) that the accelerometer will measure.
 */
public ADXL362(SPI.Port port, Range range) {
  m_spi = new SPI(port);
  m_spi.setClockRate(3000000);
  m_spi.setMSBFirst();
  m_spi.setSampleDataOnFalling();
  m_spi.setClockActiveLow();
  m_spi.setChipSelectActiveLow();

  // Validate the part ID
  ByteBuffer transferBuffer = ByteBuffer.allocateDirect(3);
  transferBuffer.put(0, kRegRead);
  transferBuffer.put(1, kPartIdRegister);
  m_spi.transaction(transferBuffer, transferBuffer, 3);
  if (transferBuffer.get(2) != (byte) 0xF2) {
    m_spi.free();
    m_spi = null;
    DriverStation.reportError("could not find ADXL362 on SPI port " + port.value, false);
    return;
  }

  setRange(range);

  // Turn on the measurements
  transferBuffer.put(0, kRegWrite);
  transferBuffer.put(1, kPowerCtlRegister);
  transferBuffer.put(2, (byte) (kPowerCtl_Measure | kPowerCtl_UltraLowNoise));
  m_spi.write(transferBuffer, 3);

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


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