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


Java PIDSourceType.kDisplacement方法代码示例

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


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

示例1: Drivetrain

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的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: SetDistanceToBox

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public SetDistanceToBox(double distance) {
	requires(Robot.drivetrain);
	pid = new PIDController(-2, 0, 0, new PIDSource() {
		PIDSourceType m_sourceType = PIDSourceType.kDisplacement;

		public double pidGet() {
			return Robot.drivetrain.getDistanceToObstacle();
		}

		@Override
		public void setPIDSourceType(PIDSourceType pidSource) {
			m_sourceType = pidSource;
		}

		@Override
		public PIDSourceType getPIDSourceType() {
			return m_sourceType;
		}
	}, new PIDOutput() {
		public void pidWrite(double d) {
			Robot.drivetrain.drive(d, d);
		}
	});
	pid.setAbsoluteTolerance(0.01);
	pid.setSetpoint(distance);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:27,代码来源:SetDistanceToBox.java

示例3: DriveStraight

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public DriveStraight(double distance) {
    requires(Robot.drivetrain);
    pid = new PIDController(4, 0, 0,
            new PIDSource() {
                PIDSourceType m_sourceType = PIDSourceType.kDisplacement;

                public double pidGet() {
                    return Robot.drivetrain.getDistance();
                }

                @Override
                public void setPIDSourceType(PIDSourceType pidSource) {
                  m_sourceType = pidSource;
                }

                @Override
                public PIDSourceType getPIDSourceType() {
                    return m_sourceType;
                }
            },
            new PIDOutput() { public void pidWrite(double d) {
                Robot.drivetrain.drive(d, d);
            }});
    pid.setAbsoluteTolerance(0.01);
    pid.setSetpoint(distance);
}
 
开发者ID:FRC1458,项目名称:turtleshell,代码行数:27,代码来源:DriveStraight.java

示例4: DriveToPeg

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public DriveToPeg(){		
	double distance = .2;
	
	requires(Robot.driveBase);
	double kP = -.4;
	double kI = 1;
	double kD = 5;
	
	pid = new PIDController(kP, kI, kD, new PIDSource() {
		PIDSourceType m_sourceType = PIDSourceType.kDisplacement;

		@Override
		public double pidGet() {
			return Robot.driveBase.getDistanceAhead();
		}

		@Override
		public void setPIDSourceType(PIDSourceType pidSource) {
			m_sourceType = pidSource;
		}

		@Override
		public PIDSourceType getPIDSourceType() {
			return m_sourceType;
		}
	}, new PIDOutput() {
		@Override
		public void pidWrite(double d) {
			Robot.driveBase.driveForward(d);
			System.out.println(d);
		}
	});
	pid.setAbsoluteTolerance(0.01);
	pid.setSetpoint(distance);
	pid.setOutputRange(0, .35);
	
	SmartDashboard.putData("driveToPeg", pid);
}
 
开发者ID:FRC-6413,项目名称:steamworks-java,代码行数:39,代码来源:DriveToPeg.java

示例5: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
@Override
public PIDSourceType getPIDSourceType() 
{
	return PIDSourceType.kDisplacement;
}
 
开发者ID:RAR1741,项目名称:RA17_RobotCode,代码行数:6,代码来源:FakePIDSource.java

示例6: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
@Override
public PIDSourceType getPIDSourceType() {
    return PIDSourceType.kDisplacement;
}
 
开发者ID:Team334,项目名称:R2017,代码行数:5,代码来源:GyroSource.java

示例7: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
@Override
public PIDSourceType getPIDSourceType() {
	// TODO Auto-generated method stub
	return PIDSourceType.kDisplacement;
}
 
开发者ID:1757WestwoodRobotics,项目名称:2017-Steamworks,代码行数:6,代码来源:VisionCenterPIDSource.java

示例8: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public PIDSourceType getPIDSourceType()
{
	return PIDSourceType.kDisplacement;
}
 
开发者ID:BytingBulldogs3539,项目名称:BBLIB,代码行数:5,代码来源:bbPIDFeedback.java

示例9: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
@Override
public PIDSourceType getPIDSourceType() {
	return PIDSourceType.kDisplacement;
}
 
开发者ID:Team997Coders,项目名称:2017SteamBot2,代码行数:5,代码来源:VisionDistanceSource.java

示例10: GyroInput

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public GyroInput(Gyro gyro) {
	this.gyro = gyro;
	type = PIDSourceType.kDisplacement;
}
 
开发者ID:Team694,项目名称:DriveStraightBot,代码行数:5,代码来源:Drivetrain.java

示例11: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
@Override
default PIDSourceType getPIDSourceType() {
  return PIDSourceType.kDisplacement;
}
 
开发者ID:TeamMeanMachine,项目名称:meanlib,代码行数:5,代码来源:DisplacementPIDSource.java

示例12: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public PIDSourceType getPIDSourceType() {
  return PIDSourceType.kDisplacement;
}
 
开发者ID:ArcticWarriors,项目名称:snobot-2017,代码行数:4,代码来源:PIDCommand.java

示例13: if

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public void	setPIDSourceType(PIDSourceType pidSource) {
    if (pidSource != PIDSourceType.kDisplacement) {
        System.out.println("IMUPIDSource only supports kDisplacement");
    }
}
 
开发者ID:Spartronics4915,项目名称:2016-Stronghold,代码行数:6,代码来源:IMUPIDSource.java

示例14: getPIDSourceType

import edu.wpi.first.wpilibj.PIDSourceType; //导入方法依赖的package包/类
public PIDSourceType getPIDSourceType() {
    return PIDSourceType.kDisplacement;
}
 
开发者ID:Spartronics4915,项目名称:2016-Stronghold,代码行数:4,代码来源:IMUPIDSource.java


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