微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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)",driveTrainCIMFrontLeft);
    LiveWindow.addActuator("RearRight (1)",driveTrainCIMRearRight);
    LiveWindow.addActuator("FrontRight (11)",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,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",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,Robot.navx.getAHRS()/*Robot.visionTest*/,new MyPidOutput());
      turnController.setInputRange(-180,maxOutputRange);
      turnController.setAbsolutetolerance(kTolerancedegrees);
      turnController.setContinuous(true); // Todo is this what we want???

      /* Add the PID Controller to the Test-mode dashboard,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);
//      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);
//      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",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,0x0c00000e,true);

  calibrate();

  HAL.report(tResourceType.kResourceType_ADXRS450,port.value);
  LiveWindow.addSensor("ADXRS450_Gyro",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(),0x0c000000,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,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,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_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",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",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,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",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",(Victor) driveTrainLeftFront);

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

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

    driveTrainRightRear = new Victor(3);
    LiveWindow.addActuator("DriveTrain",(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

    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);  //calls the parent constructor with arguments P,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.9,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",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",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,"D");
  } else {
    HAL.report(tResourceType.kResourceType_GearTooth,0);
  }
  LiveWindow.addSensor("GearTooth",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);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。