當前位置: 首頁>>代碼示例>>Java>>正文


Java PIDController.disable方法代碼示例

本文整理匯總了Java中edu.wpi.first.wpilibj.PIDController.disable方法的典型用法代碼示例。如果您正苦於以下問題:Java PIDController.disable方法的具體用法?Java PIDController.disable怎麽用?Java PIDController.disable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.wpi.first.wpilibj.PIDController的用法示例。


在下文中一共展示了PIDController.disable方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Drivetrain

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
public Drivetrain() {	
	leftWheelsPIDSource = new EncoderPIDSource(RobotMap.driveEncoderLeft, 1.0 / 14.0, PIDSourceType.kDisplacement);
	//rightWheelsPIDSource = new EncoderPIDSource(RobotMap.driveEncoderRight, -1.0 / 14.0, PIDSourceType.kDisplacement);
	rightWheelsPIDSource = new EncoderPIDSource(RobotMap.driveEncoderRight, ((-1.0 / 360.0) * 250.0) * (1.0 / 14.0), PIDSourceType.kDisplacement);
	
	compassPID = new PIDController(0.1, 0, 0, new CompassPIDSource(), new DummyPIDOutput());
	gyroPID = new PIDController(0.01, 0.0001, 0.00001, new GyroPIDSource(), new DummyPIDOutput());
	leftWheelsPID = new PIDController(0.02, 0.0004, 0, leftWheelsPIDSource, new DummyPIDOutput());
	rightWheelsPID = new PIDController(0.02, 0.0004, 0, rightWheelsPIDSource, new DummyPIDOutput());

	compassPID.disable();
	compassPID.setOutputRange(-1.0, 1.0); // Set turning speed range
	compassPID.setPercentTolerance(5.0); // Set tolerance of 5%
	
	gyroPID.disable();
	gyroPID.setOutputRange(-1.0, 1.0); // Set turning speed range
	gyroPID.setPercentTolerance(5.0); // Set tolerance of 5%
	
	leftWheelsPID.disable();
	leftWheelsPID.setOutputRange(-1.0, 1.0);
	
	rightWheelsPID.disable();
	rightWheelsPID.setOutputRange(-1.0, 1.0);
}
 
開發者ID:Team4761,項目名稱:2016-Robot-Code,代碼行數:25,代碼來源:Drivetrain.java

示例2: SwervePod

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
public SwervePod(SpeedController turningMotor, SpeedController driveMotor, Encoder encoder, double encoderDistancePerTick, AngularSensor directionSensor) {
    // Initialize motors //
    _turningMotor = turningMotor;
    _driveMotor = driveMotor;
    
    // Initialize sensors //
    _encoder = encoder;
    _encoder.setPIDSourceParameter(PIDSource.PIDSourceParameter.kRate);
    _encoder.setDistancePerPulse(encoderDistancePerTick);
    _encoder.start();
    _directionSensor = directionSensor;
    
    // Initialize PID loops //
    // Turning //
    PIDTurning = new PIDController(Kp_turning, Ki_turning, Kd_turning, _directionSensor, _turningMotor);
    PIDTurning.setOutputRange(minSpeed, maxSpeed);
    PIDTurning.setContinuous(true);
    PIDTurning.setAbsoluteTolerance(tolerance_turning);
    PIDTurning.enable();
    
    // Linear driving //
    PIDDriving = new PIDController(Kp_driving, Ki_driving, Kd_driving, _encoder, _driveMotor);
    PIDDriving.setOutputRange(minSpeed, maxSpeed);
    PIDDriving.disable(); //TODO: Enable
}
 
開發者ID:Whillikers,項目名稱:SwerveDrive,代碼行數:26,代碼來源:SwervePod.java

示例3: CrabDrive

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
CrabDrive() throws CANTimeoutException
    {
        gyro = new GyroSensor(ReboundRumble.ROBOT_ANGLE_GYRO_SENSOR);
        front = new SteeringUnit(ReboundRumble.FRONT_STEERING_CAN_ID,
                ReboundRumble.FRONT_LEFT_CAN_ID,
                ReboundRumble.FRONT_RIGHT_CAN_ID);
        rear = new SteeringUnit(ReboundRumble.REAR_STEERING_CAN_ID,
                ReboundRumble.REAR_LEFT_CAN_ID,
                ReboundRumble.REAR_RIGHT_CAN_ID);
        turnController = new PIDController(TURN_CONTROLLER_PROPORTIONAL,
                TURN_CONTROLLER_INTEGRAL,
                TURN_CONTROLLER_DIFFERENTIAL,
                gyro,
                this);
        turnController.setOutputRange(MIN_OUTPUT, MAX_OUTPUT);
        turnController.disable();
//        leftBallSensor = new UltraSonicSensor(ReboundRumble.LEFT_BALL_RANGE_SENSOR);
//        rightBallSensor = new UltraSonicSensor(ReboundRumble.RIGHT_BALL_RANGE_SENSOR);
    }
 
開發者ID:FIRST-FRC-Team-2028,項目名稱:2012,代碼行數:20,代碼來源:CrabDrive.java

示例4: RotateWithPIDTankDrive

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
public RotateWithPIDTankDrive(double targetAngleDegrees) {
      requires(Robot.driveTrain);
      
/*      try {
			*//***********************************************************************
			 * navX-MXP: - This is all defined in NavX Subsystem.
			 * - Communication via RoboRIO MXP (SPI, I2C, TTL UART) and USB.            
			 * - See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface.
			 * 
			 * navX-Micro:
			 * - Communication via I2C (RoboRIO MXP or Onboard) and USB.
			 * - See http://navx-micro.kauailabs.com/guidance/selecting-an-interface.
			 * 
			 * Multiple navX-model devices on a single robot are supported.
			 ************************************************************************//*
  		
      //ahrs = new AHRS(SerialPort.Port.kUSB); 
      } catch (RuntimeException ex ) {
          DriverStation.reportError("Error instantiating navX MXP:  " + ex.getMessage(), true);
      }*/
      
      this.targetAngleDegrees=targetAngleDegrees;
      turnController2 = new PIDController(kP, kI, kD, kF, NavX.ahrs, this);
      turnController2.setInputRange(-180.0f,  180.0f);
      //turnController2.setOutputRange(-1.0, 1.0);
      turnController2.setOutputRange(-0.7, 0.7);
      turnController2.setAbsoluteTolerance(kToleranceDegrees);
      turnController2.setContinuous(true);
      turnController2.disable();
    }
 
開發者ID:FRC2832,項目名稱:Robot_2017,代碼行數:31,代碼來源:RotateWithPIDTankDrive.java

示例5: SwerveModule

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
public SwerveModule(CANTalon d, CANTalon a, AnalogInput e, String name)
{
	SpeedP = Config.getSetting("speedP",1);
	SpeedI = Config.getSetting("speedI",0);
	SpeedD = Config.getSetting("speedD",0);
	SteerP = Config.getSetting("steerP",2);
	SteerI = Config.getSetting("steerI",0);
	SteerD = Config.getSetting("steerD",0);
	SteerTolerance = Config.getSetting("SteeringTolerance", .25);
	SteerSpeed = Config.getSetting("SteerSpeed", 1);
	SteerEncMax = Config.getSetting("SteerEncMax",4.792);
	SteerEncMax = Config.getSetting("SteerEncMin",0.01);
	SteerOffset = Config.getSetting("SteerEncOffset",0);
	MaxRPM = Config.getSetting("driveCIMmaxRPM", 4200);
	
	drive = d;
	drive.setPID(SpeedP, SpeedI, SpeedD);
	drive.setFeedbackDevice(FeedbackDevice.QuadEncoder);
   drive.configEncoderCodesPerRev(20);
   drive.enable();
	
	angle = a;
	
	encoder = e;
	
	encFake = new FakePIDSource(SteerOffset,SteerEncMin,SteerEncMax);
	
	PIDc = new PIDController(SteerP,SteerI,SteerD,encFake,angle);
	PIDc.disable();
	PIDc.setContinuous(true);
	PIDc.setInputRange(SteerEncMin,SteerEncMax);
	PIDc.setOutputRange(-SteerSpeed,SteerSpeed);
	PIDc.setPercentTolerance(SteerTolerance);
	PIDc.setSetpoint(2.4);
	PIDc.enable();
	s = name;
}
 
開發者ID:RAR1741,項目名稱:RA17_RobotCode,代碼行數:38,代碼來源:SwerveModule.java

示例6: SpinningWheel

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
public SpinningWheel(){
	shootingWheelPIDController = new PIDController(0.045 / 1000.0, 0.000005 / 1000.0, 1.1 / 1000.0, new TalonPIDSource(), RobotMap.shootingWheelMotor);
	shootingWheelPIDController.disable();
	
	shootingWheelPIDController.setSetpoint(0);
	shootingWheelPIDController.setContinuous(true);
	shootingWheelPIDController.setOutputRange(0, 1);
	
	shootingWheelPIDController.enable();
}
 
開發者ID:Team4761,項目名稱:2016-Robot-Code,代碼行數:11,代碼來源:SpinningWheel.java

示例7: Hood

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
public Hood() {
	pidController = new PIDController(0.075, 0.0001, 0, RobotMap.hoodPIDSource, RobotMap.hoodMotor);
	pidController.disable();
	pidController.setSetpoint(0);
	pidController.setContinuous(true);
	pidController.enable();
}
 
開發者ID:Team4761,項目名稱:2016-Robot-Code,代碼行數:8,代碼來源:Hood.java

示例8: disableWheelSpeedPIDs

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
/**
 * Disable the wheelSpeedPIDs
 * 
 * If they are already disabled, this routine does nothing.
 */
private void disableWheelSpeedPIDs() {

	for (PIDController wheelSpeedPID: wheelSpeedPIDArr) {
		wheelSpeedPID.disable();
	}

}
 
開發者ID:RunnymedeRobotics1310,項目名稱:Robot2015,代碼行數:13,代碼來源:ChassisSubsystem.java

示例9: C_GoToHeading

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
public C_GoToHeading() {
    // Use requires() here to declare subsystem dependencies
    // eg. requires(chassis);
    requires(swerve);
    PID = new PIDController(.07, 0, 0, swerve.veerGyro, this, .001);
    PID.setInputRange(-180.0, 180.0);
    PID.setOutputRange(-1.0, 1.0);
    PID.setPID(1, 0, 0);
    PID.disable();
}
 
開發者ID:VulcanRobotics,項目名稱:Veer,代碼行數:11,代碼來源:C_GoToHeading.java

示例10: Tilter

import edu.wpi.first.wpilibj.PIDController; //導入方法依賴的package包/類
private Tilter() {
    leadscrew = new BoundedTalon(Constants.TILTER_CHANNEL, Constants.TILTER_UPPER_LIMIT_SWITCH_CHANNEL, Constants.TILTER_LOWER_LIMIT_SWITCH_CHANNEL);
    accel = new ADXL345_I2C(Constants.ACCELEROMETER_CHANNEL, ADXL345_I2C.DataFormat_Range.k2G);
    accelMeasurements = new Vector();
    updateAccel();        
    pendulum = new AnalogChannel(Constants.PENDULUM_CHANNEL);
    enc = new Encoder(Constants.LEADSCREW_ENCODER_A_CHANNEL, Constants.LEADSCREW_ENCODER_B_CHANNEL);
    enc.setDistancePerPulse(Constants.TILTER_DISTANCE_PER_PULSE);
    enc.start();
    Thread t = new Thread(new Runnable() {
        public void run() {
            Tilter.net = new NetworkIO();
        }
    });
    t.start();
    controller = new PIDController(Constants.PVAL_T, Constants.IVAL_T, Constants.DVAL_T, enc, new PIDOutput() {
        public void pidWrite(double output) {
            setLeadscrewMotor(output);
        }
    }); 
    controller.setPercentTolerance(0.01);
    controller.disable();
    updatePID();
    initialReadingTimer = new Timer();
    initialReadingTimer.schedule(new TimerTask() {

        public void run() {
            initialLeadLength = calcLeadscrewLength(getAveragedAccelBasedAngle());
        }
    }, INITIAL_ANGLE_MEASUREMENT_DELAY);
}
 
開發者ID:Team694,項目名稱:desiree,代碼行數:32,代碼來源:Tilter.java


注:本文中的edu.wpi.first.wpilibj.PIDController.disable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。