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


Java PIDController.enable方法代码示例

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


在下文中一共展示了PIDController.enable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
protected void initialize() {
    	pid = new PIDController(0.1, 0.1, 0, RobotMap.imu, new TurnController(), 0.01);
    	
    	startingAngle = RobotMap.imu.getYaw();
    	double deltaAngle = angle + startingAngle;
//    	deltaAngle %= 360;
    	while (deltaAngle >= 180)
    		deltaAngle -= 360;
    	while (deltaAngle < -180)
    		deltaAngle += 360;
    	Preferences.getInstance().putDouble("YawSetpoint", deltaAngle);
    	
    	pid.setAbsoluteTolerance(2);
    	pid.setInputRange(-180, 180);
    	pid.setContinuous(true);
    	pid.setOutputRange(-1 * rotateSpeed, 1 * rotateSpeed);
    	pid.setSetpoint(deltaAngle);
    	pid.enable();
    	//SmartDashboard.putData("PID", pid);
    
    }
 
开发者ID:FRC2832,项目名称:Robot_2015,代码行数:22,代码来源:Rotate.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: initialize

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
protected void initialize() {
    
    translator = new PIDOutputTranslator();
    
    //controller = new PIDController(0.00546875, 0, 0, driveTrain.gyro, translator);
    
    // 2/14/13 we tested and got: P 0.005554872047244094 I 2.8125000000000003E-4
    //THESE ARE SLIGHTLY TOO BIG!!!!!
    controller = new PIDController((oi.getDriveyStickThrottle() + 1.0) * 0.00546875, (oi.getLeftStickThrottle() + 1.0) * 0.001, 0, driveTrain.gyro, translator);
    // P = 0.00546875
    initialAngle = driveTrain.getGyroAngle();
    controller.setSetpoint(initialAngle + angle);
    controller.setPercentTolerance(1);
    controller.setInputRange(-360, 360);
    controller.enable();
}
 
开发者ID:tglem89,项目名称:2013-code-v2,代码行数:17,代码来源:CloseLoopAngleDrive.java

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

示例5: GyroPID

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
public GyroPID() {
    gyroSource = new GyroSource();
    defaultOutput = new DefaultOutput();

    gyroPID = new PIDController(Constants.GYRO_P, Constants.GYRO_I, Constants.GYRO_D, gyroSource, defaultOutput);
    gyroPID.setContinuous();
    gyroPID.setOutputRange(-Constants.GYRO_CAP, Constants.GYRO_CAP);
    gyroPID.enable();

    SmartDashboard.putData("GryoPID", gyroPID);
}
 
开发者ID:Team334,项目名称:R2017,代码行数:12,代码来源:GyroPID.java

示例6: VisionAreaPID

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
public VisionAreaPID() {
    visionAreaSource = new VisionAreaSource();
    defaultOutput = new DefaultOutput();

    areaPID = new PIDController(Constants.AREA_P, Constants.AREA_I, Constants.AREA_D, visionAreaSource, defaultOutput);
    areaPID.setContinuous();
    areaPID.setOutputRange(-Constants.AREA_CAP, Constants.AREA_CAP);
    areaPID.enable();

    SmartDashboard.putData("AreaPID", areaPID);
}
 
开发者ID:Team334,项目名称:R2017,代码行数:12,代码来源:VisionAreaPID.java

示例7: VisionOffsetPID

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
public VisionOffsetPID() {
    visionOffsetSource = new VisionOffsetSource();
    defaultOutput = new DefaultOutput();

    offsetPID = new PIDController(Constants.OFFSET_P, Constants.OFFSET_I, Constants.OFFSET_D, visionOffsetSource, defaultOutput);
    offsetPID.setSetpoint(0);
    offsetPID.setContinuous();
    offsetPID.setOutputRange(-Constants.OFFSET_CAP, Constants.OFFSET_CAP);
    offsetPID.enable();
    SmartDashboard.putData("OffsetPID", offsetPID);
}
 
开发者ID:Team334,项目名称:R2017,代码行数:12,代码来源:VisionOffsetPID.java

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

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

示例10: SwerveDrive

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
public SwerveDrive() {
        turnPositionPID = new PIDController(-1.5, -0.0, -6.0, new PidTurnPositionSourceOutput(), new PidTurnPositionSourceOutput());
        turnPositionPID.setInputRange( -Math.PI, Math.PI );
        turnPositionPID.setContinuous( true );
        turnPositionPID.setAbsoluteTolerance( Math.PI/180.0*5.0 );
        turnPositionPID.setOutputRange(-1.0, 1.0);
        turnPositionPID.enable();
        SmartDashboard.putData("Turn Position PID", turnPositionPID);

        accelerometerAngle = 0.0;
        autoSteer = false;
        fieldSteer = false;
        fieldMove = true;
        prevXVelocity = 0;
        prevYVelocity = 0;
        handsOffStarted = false;
        timeHandsOffStarted = 0.0;
        gyroAngle = 0.0;
        gyroOffset = 0.0;
//        resetDistance();
        
        turnSpeed = 0;
        turnSpeedPID = new PIDController(-0.05, -0.0, -0.0, new PidTurnSpeedSourceOutput(), new PidTurnSpeedSourceOutput());
        turnSpeedPID.setInputRange( -6.0, 6.0 );
        turnSpeedPID.setOutputRange(-1.0, 1.0);
        turnSpeedPID.setAbsoluteTolerance( 0.01 );
        turnSpeedFeed = 0.0;
        turnSpeedSum = 0.0;
        SmartDashboard.putData("Turn Speed PID", turnSpeedPID);

        lrVect= new SwerveVector(RobotMap.leftRearSwerve, -16.0,-11.0, -Math.PI/4.0); 
        lfVect= new SwerveVector(RobotMap.leftFrontSwerve, -16.0,11.0, Math.PI/4.0);  
        rrVect= new SwerveVector(RobotMap.rightRearSwerve, 16.0,-11.0, Math.PI/4.0); 
        rfVect= new SwerveVector(RobotMap.rightFrontSwerve, 16.0,11.0, -Math.PI/4.0);
        
        SmartDashboard.putData("Swerve Drive Subsystem", this);
    }
 
开发者ID:Tmm2471,项目名称:Swerve,代码行数:38,代码来源:SwerveDrive.java

示例11: initialize

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
protected void initialize() {
    
    translator = new PIDOutputTranslator();
    
    controller = new PIDController((oi.getDriveyStickThrottle() + 1.0) / 20.0, 0, 0, driveTrain.gyro, translator);
    // P = 0.00546875
    controller.setSetpoint(driveTrain.getGyroAngle() + angle);
    controller.setPercentTolerance(1);
    controller.setInputRange(-360, 360);
    controller.enable();
}
 
开发者ID:tglem89,项目名称:2013-code-v2,代码行数:12,代码来源:PIDYawTest.java

示例12: enableWheelSpeedPIDs

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
/**
 * Enable and reset the wheel speed PIDs.
 * 
 * If they are already enabled, this routine does nothing.
 */
private void enableWheelSpeedPIDs() {

	for (PIDController wheelSpeedPID: wheelSpeedPIDArr) {

		if (!wheelSpeedPID.isEnable()) {
			wheelSpeedPID.reset();
			wheelSpeedPID.enable();

		}
	}

}
 
开发者ID:RunnymedeRobotics1310,项目名称:Robot2015,代码行数:18,代码来源:ChassisSubsystem.java

示例13: onBuild

import edu.wpi.first.wpilibj.PIDController; //导入方法依赖的package包/类
private void onBuild() {
    leftEncoder.start();
    rightEncoder.start();

    StraightPID straight = new StraightPID();
    straightPid = new PIDController(0.001, 0, 0.02, straight, straight);

    SmartDashboard.putData("Straight PID", straightPid);

    straightPid.enable();

    new Thread(this).start();
}
 
开发者ID:Team3309,项目名称:frc-2013-offseason,代码行数:14,代码来源:Drive.java


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