Java 类edu.wpi.first.wpilibj.livewindow.LiveWindow 实例源码

项目:2017-emmet    文件:RobotMap.java   
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);
}
项目:STEAMworks    文件:AutoDriveDistance.java   
/**
* 
* @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);
  }
项目:STEAMworks    文件:AutoSteerDriveToPeg.java   
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);
}
项目:STEAMworks    文件:AutoTurnByVision.java   
/**
* 
* @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);
  }
项目:FRC-2017-Public    文件:ADXRS453_Gyro.java   
/**
 * 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);
}
项目:FRC-Robotics-2016-Team-2262    文件:Robot.java   
/**
 * 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());
     */
}
项目:FB2016    文件:BallGetter.java   
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);
    }
项目:FB2016    文件:DefenseBuster.java   
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());
    }
项目:snobot-2017    文件:Jaguar.java   
/**
 * 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);
}
项目:snobot-2017    文件:ADXRS450_Gyro.java   
/**
 * 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);
}
项目:snobot-2017    文件:Ultrasonic.java   
/**
 * 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);
}
项目:Frc2016FirstStronghold    文件:ADXRS450_Gyro.java   
/**
 * 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);
}
项目:Frc2016FirstStronghold    文件:AnalogOutput.java   
/**
 * 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);
}
项目:Frc2016FirstStronghold    文件:Ultrasonic.java   
/**
 * 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);
}
项目:Frc2016FirstStronghold    文件:AnalogGyro.java   
/**
 * 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);
}
项目:Frc2016FirstStronghold    文件:Solenoid.java   
/**
 * Common function to implement constructor behavior.
 */
private synchronized void initSolenoid() {
  checkSolenoidModule(m_moduleNumber);
  checkSolenoidChannel(m_channel);

  try {
    m_allocated.allocate(m_moduleNumber * kSolenoidChannels + m_channel);
  } catch (CheckedAllocationException e) {
    throw new AllocationException("Solenoid channel " + m_channel + " on module "
      + m_moduleNumber + " is already allocated");
  }

  long port = SolenoidJNI.getPortWithModule((byte) m_moduleNumber, (byte) m_channel);
  m_solenoid_port = SolenoidJNI.initializeSolenoidPort(port);

  LiveWindow.addActuator("Solenoid", m_moduleNumber, m_channel, this);
  UsageReporting.report(tResourceType.kResourceType_Solenoid, m_channel, m_moduleNumber);
}
项目:Frc2016FirstStronghold    文件:Relay.java   
/**
 * Common relay initialization method. This code is common to all Relay
 * constructors and initializes the relay and reserves all resources that need
 * to be locked. Initially the relay is set to both lines at 0v.
 */
private void initRelay() {
  SensorBase.checkRelayChannel(m_channel);
  try {
    if (m_direction == Direction.kBoth || m_direction == Direction.kForward) {
      relayChannels.allocate(m_channel * 2);
      UsageReporting.report(tResourceType.kResourceType_Relay, m_channel);
    }
    if (m_direction == Direction.kBoth || m_direction == Direction.kReverse) {
      relayChannels.allocate(m_channel * 2 + 1);
      UsageReporting.report(tResourceType.kResourceType_Relay, m_channel + 128);
    }
  } catch (CheckedAllocationException e) {
    throw new AllocationException("Relay channel " + m_channel + " is already allocated");
  }

  m_port = DIOJNI.initializeDigitalPort(DIOJNI.getPort((byte) m_channel));

  m_safetyHelper = new MotorSafetyHelper(this);
  m_safetyHelper.setSafetyEnabled(false);

  LiveWindow.addActuator("Relay", m_channel, this);
}
项目:Frc2016FirstStronghold    文件:AnalogInput.java   
/**
 * 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);
}
项目:Frc2016FirstStronghold    文件:CANTalon.java   
/**
 * Constructor for the CANTalon device.
 * @param deviceNumber The CAN ID of the Talon SRX
 * @param controlPeriodMs The period in ms to send the CAN control frame.
 *                        Period is bounded to [1ms,95ms].
 */
public CANTalon(int deviceNumber, int controlPeriodMs) {
  m_deviceNumber = deviceNumber;
  /* bound period to be within [1 ms,95 ms] */
  m_handle = CanTalonJNI.new_CanTalonSRX(deviceNumber, controlPeriodMs);
  m_safetyHelper = new MotorSafetyHelper(this);
  m_controlEnabled = true;
  m_profile = 0;
  m_setPoint = 0;
  m_codesPerRev = 0;
  m_numPotTurns = 0;
  m_feedbackDevice = FeedbackDevice.QuadEncoder;
  setProfile(m_profile);
  applyControlMode(TalonControlMode.PercentVbus);
  LiveWindow.addActuator("CANTalon", m_deviceNumber, this);
}
项目:Frc2017FirstSteamWorks    文件:FrcTest.java   
@Override
public void runPeriodic(double elapsedTime)
{
    switch (test)
    {
        case SENSORS_TEST:
            //
            // Allow TeleOp to run so we can control the robot in sensors test mode.
            //
            super.runPeriodic(elapsedTime);
            doSensorsTest();
            break;

        case DRIVE_MOTORS_TEST:
            doDriveMotorsTest();
            break;

        case LIVE_WINDOW:
            LiveWindow.run();
            break;

        default:
            break;
    }
}
项目:FRCStronghold2016    文件:CustomGyro.java   
/**
 * 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);
}
项目:Robot_2017    文件:RobotMap.java   
public static void init() {
      // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    compressor = new Compressor();

      driveTrainLeftFront = new CANTalon(1);
      LiveWindow.addActuator("DriveTrain", "LeftFront", driveTrainLeftFront);
      driveTrainRightFront = new CANTalon(3);
      LiveWindow.addActuator("DriveTrain", "RightFront", driveTrainRightFront);
      driveTrainLeftRear = new CANTalon(2);
      driveTrainLeftRear.changeControlMode(TalonControlMode.Follower);
      driveTrainLeftRear.set(driveTrainLeftFront.getDeviceID());
      LiveWindow.addActuator("DriveTrain", "LeftRear", driveTrainLeftRear);
      driveTrainRightRear = new CANTalon(4);
      driveTrainRightRear.changeControlMode(TalonControlMode.Follower);
      driveTrainRightRear.set(driveTrainRightFront.getDeviceID());
      driveTrainRightRear.reverseOutput(false);
      LiveWindow.addActuator("DriveTrain", "RightRear", driveTrainRightRear);

      driveTrainLeftFront.setInverted(true);
      driveTrainRightFront.setInverted(true);
      driveTrainLeftRear.setInverted(true);
      driveTrainRightRear.setInverted(true);

      driveTrainRobotDrive41 = new RobotDrive(driveTrainRightFront, driveTrainLeftFront);
driveTrainRobotDrive41.setSafetyEnabled(true);
driveTrainRobotDrive41.setExpiration(0.1);
driveTrainRobotDrive41.setSensitivity(0.5);
driveTrainRobotDrive41.setMaxOutput(1.0);

      climbMotor = new CANTalon(5);
      LiveWindow.addActuator("Climbing", "Motor", climbMotor);

      lightsLightEnable = new Relay(0);
      LiveWindow.addActuator("Lights", "LightEnable", lightsLightEnable);

      gearIntakeRamp = new DoubleSolenoid(1, 0);
      LiveWindow.addActuator("GearIntake", "IntakeRamp", gearIntakeRamp);

      // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
  }
项目:Robot_2017    文件:Shooter.java   
public Shooter() {
    super();
    shooterFeeder = new CANTalon(8);
    LiveWindow.addActuator("Shooter", "Feeder", shooterFeeder);
    shooterFeeder.enableBrakeMode(false);

    shooterShootMotor = new CANTalon(7);
    LiveWindow.addActuator("Shooter", "ShootMotor", shooterShootMotor);
    shooterShootMotor.enableBrakeMode(false);
       /* choose the sensor */
    shooterShootMotor.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    shooterShootMotor.reverseSensor(true);
    shooterShootMotor.configEncoderCodesPerRev(PulsesPerRevolution); // if using FeedbackDevice.QuadEncoder

       /* set the peak and nominal outputs, 12V means full */
    shooterShootMotor.configNominalOutputVoltage(+0.0f, -0.0f);
    shooterShootMotor.configPeakOutputVoltage(+12.0f, -12.0f);

       /* set closed loop gains in slot0 */
    shooterShootMotor.setProfile(0);
    shooterShootMotor.setF(pidF);
       shooterShootMotor.setP(pidP);    

       //only change I and D to smooth out control
       shooterShootMotor.setI(0); 
       shooterShootMotor.setD(0);

    shooterAgitator = new CANTalon(10);
    LiveWindow.addActuator("Shooter", "Agitator", shooterAgitator);
    shooterAgitator.enableBrakeMode(false);
}
项目:Robot_2017    文件:GearScore.java   
public GearScore() {
    super();

    gearScorePusher = new DoubleSolenoid(3, 4);
    LiveWindow.addActuator("GearScore", "Pusher", gearScorePusher);

    gearScoreDoor = new DoubleSolenoid(6, 5);
    LiveWindow.addActuator("GearScore", "Door", gearScoreDoor);
}
项目:Robot_2017    文件:BallIntake.java   
public BallIntake() {
    super();
    ballIntakeMotor = new CANTalon(9);
    LiveWindow.addActuator("BallIntake", "Intake", ballIntakeMotor);
    ballIntakeMotor.enableBrakeMode(false);

}
项目:SteamWorks    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driveTrainLeftFront = new Victor(0);
    LiveWindow.addActuator("DriveTrain", "LeftFront", (Victor) driveTrainLeftFront);

    driveTrainLeftRear = new Victor(1);
    LiveWindow.addActuator("DriveTrain", "LeftRear", (Victor) driveTrainLeftRear);

    driveTrainRightFront = new Victor(2);
    LiveWindow.addActuator("DriveTrain", "RightFront", (Victor) driveTrainRightFront);

    driveTrainRightRear = new Victor(3);
    LiveWindow.addActuator("DriveTrain", "RightRear", (Victor) driveTrainRightRear);

    driveTrainRobotDrive = new RobotDrive(driveTrainLeftFront, driveTrainLeftRear,
          driveTrainRightFront, driveTrainRightRear);

    driveTrainRobotDrive.setSafetyEnabled(false);
    driveTrainRobotDrive.setExpiration(0.1);
    driveTrainRobotDrive.setSensitivity(1.0);
    driveTrainRobotDrive.setMaxOutput(1.0);

    shootershooterTalon = new CANTalon(0);
    LiveWindow.addActuator("Shooter", "shooterTalon", shootershooterTalon);


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    // set this up
    gyro = new ADXRS450_Gyro();
}
项目:Practice_Robot_Code    文件:RobotMap.java   
public static void init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    motorRelayMotorRelay1 = new Relay(0);
    LiveWindow.addActuator("MotorRelay", "MotorRelay1", motorRelayMotorRelay1);

    lFront = new CANTalon(1);
    LiveWindow.addActuator("Wheels", "Speed Controller 1", (CANTalon) lFront);

    rFront = new CANTalon(3);
    LiveWindow.addActuator("Wheels", "Speed Controller 2", (CANTalon) rFront);

    lRear = new CANTalon(2);
    LiveWindow.addActuator("Wheels", "Speed Controller 3", (CANTalon) lRear);

    rRear = new CANTalon(4);
    LiveWindow.addActuator("Wheels", "Speed Controller 4", (CANTalon) rRear);

    driveSystem = new RobotDrive(lFront, lRear,
          rFront, rRear);

    driveSystem.setSafetyEnabled(true);
    driveSystem.setExpiration(0.1);
    driveSystem.setSensitivity(0.5);
    driveSystem.setMaxOutput(1.0);

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:Steamworks2017Robot    文件:Robot.java   
/**
 * This function is called periodically during test mode.
 */
@Override
public void testPeriodic() {
  try {
    logger.trace("testPeriodic()");
    LiveWindow.run();
    vision.setVisionEnabled(true);
  } catch (Throwable ex) {
    logger.error("testPeriodic error", ex);
    ex.printStackTrace();
  }
}
项目:GearBot    文件:RobotMap.java   
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
}
项目:RobotCode2018    文件:WPI_TalonSRXF.java   
/**
 * Constructor
 */
public WPI_TalonSRXF(int deviceNumber)
{
    super(deviceNumber);
    HAL.report(66, deviceNumber + 1);
    m_description = "Talon SRX " + deviceNumber;
    /* prep motor safety */
    m_safetyHelper = new MotorSafetyHelper(this);
    m_safetyHelper.setExpiration(0.0);
    m_safetyHelper.setSafetyEnabled(false);

    LiveWindow.add(this);
    setName("Talon SRX ", deviceNumber);
}
项目:VikingRobot    文件:Rotate.java   
public Rotate(double degrees) {
    super(.0125,.008,.2);
    requires(Robot.drivebase);
    getPIDController().setAbsoluteTolerance(1);
    getPIDController().setOutputRange(-.8,.8);
    setSetpoint(degrees);
    LiveWindow.addActuator("Drivebase", "RotateRelative PID Controller", getPIDController());
}
项目:CMonster2017    文件:DistancePID.java   
public DistancePID() {  

    super("DistancePID", 0.14, 0.0, 0.01);  //calls the parent constructor with arguments P,I,D
    //working PIDs: 0.24, 0, 0

    setAbsoluteTolerance(0.2);       // more parameters
    getPIDController().setContinuous(false);
    setInputRange(-10,  10);
    setOutputRange(-0.25, 0.25); //1/5 speed

    LiveWindow.addActuator("DistancePID", "DistancePID", getPIDController());
}
项目:CMonster2017    文件:HeadingPID.java   
public HeadingPID() {  
    super("HeadingPID", 0.06, 0.0, 0.0);  //calls the parent constructor with arguments P,I,D
    //keep P term at 0.06!!!!

    setAbsoluteTolerance(0.5);          // more parameters
    getPIDController().setContinuous(false);
    setInputRange(-180.0,  180.0);
    setOutputRange(-0.25, 0.25);

    LiveWindow.addActuator("HeadingPID", "HeadingPID", getPIDController());
}
项目:CMonster2017    文件:Robot.java   
/**
 * 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);
}
项目:2017SteamBot2    文件:DriveToAngle.java   
public DriveToAngle(double angle, PIDSource source) {
    requires(Robot.driveTrain);
    setPoint = angle;

    Robot.driveTrain.ahrs.reset();

    controller = new PIDController(0.75, 0, 0.9, 0, source, this);
    controller.setInputRange(-180, 180);
    controller.setOutputRange(-.26, .26);
    controller.setAbsoluteTolerance(1.0);
    controller.setContinuous(true);

    LiveWindow.addActuator("DriveToAngle", "RotationController", controller);
}
项目:Stronghold    文件:Drivetrain.java   
public void initDefaultCommand() {
    setDefaultCommand(new TankDrive());
    robotDrive.setInvertedMotor(MotorType.kFrontLeft, true);
    robotDrive.setInvertedMotor(MotorType.kRearLeft, true);
    LiveWindow.addActuator("Drive Motors", "fRight", fRight);
    LiveWindow.addActuator("Drive Motors", "fLeft", fLeft);
    LiveWindow.addActuator("Drive Motors", "bRight", bRight);
    LiveWindow.addActuator("Drive Motors", "bLeft", bLeft);
}
项目:snobot-2017    文件:ADXL362.java   
/**
 * 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);
}
项目:snobot-2017    文件:AnalogOutput.java   
/**
 * Construct an analog output on a specified MXP channel.
 *
 * @param channel The channel number to represent.
 */
public AnalogOutput(final int channel) {
  m_channel = channel;

  SensorBase.checkAnalogOutputChannel(channel);

  final int portHandle = AnalogJNI.getPort((byte) channel);
  m_port = AnalogJNI.initializeAnalogOutputPort(portHandle);

  LiveWindow.addSensor("AnalogOutput", channel, this);
  HAL.report(tResourceType.kResourceType_AnalogOutput, channel);
}
项目:snobot-2017    文件:GearTooth.java   
/**
 * Construct a GearTooth sensor given a channel.
 *
 * @param channel            The DIO channel that the sensor is connected to. 0-9 are on-board,
 *                           10-25 are on the MXP port
 * @param directionSensitive True to enable the pulse length decoding in hardware to specify count
 *                           direction.
 */
public GearTooth(final int channel, boolean directionSensitive) {
  super(channel);
  enableDirectionSensing(directionSensitive);
  if (directionSensitive) {
    HAL.report(tResourceType.kResourceType_GearTooth, channel, 0, "D");
  } else {
    HAL.report(tResourceType.kResourceType_GearTooth, channel, 0);
  }
  LiveWindow.addSensor("GearTooth", channel, this);
}
项目:snobot-2017    文件:Encoder.java   
/**
 * Common initialization code for Encoders. This code allocates resources for Encoders and is
 * common to all constructors.
 *
 * <p>The encoder will start counting immediately.
 *
 * @param reverseDirection If true, counts down instead of up (this is all relative)
 */
private void initEncoder(boolean reverseDirection, final EncodingType type) {
  m_encoder = EncoderJNI.initializeEncoder(m_aSource.getPortHandleForRouting(),
      m_aSource.getAnalogTriggerTypeForRouting(), m_bSource.getPortHandleForRouting(),
      m_bSource.getAnalogTriggerTypeForRouting(), reverseDirection, type.value);

  m_pidSource = PIDSourceType.kDisplacement;

  HAL.report(tResourceType.kResourceType_Encoder, getFPGAIndex(), type.value);
  LiveWindow.addSensor("Encoder", m_aSource.getChannel(), this);
}