本文整理匯總了Java中edu.wpi.first.wpilibj.Encoder.setReverseDirection方法的典型用法代碼示例。如果您正苦於以下問題:Java Encoder.setReverseDirection方法的具體用法?Java Encoder.setReverseDirection怎麽用?Java Encoder.setReverseDirection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.wpi.first.wpilibj.Encoder
的用法示例。
在下文中一共展示了Encoder.setReverseDirection方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: Arm
import edu.wpi.first.wpilibj.Encoder; //導入方法依賴的package包/類
public Arm() {
super("arm", kP, kI, kD);
motor = new Talon(RobotMap.ArmMap.PWM_MOTOR);
motor.setInverted(RobotMap.ArmMap.INV_MOTOR);
encoder = new Encoder(RobotMap.ArmMap.DIO_ENCODER_A, RobotMap.ArmMap.DIO_ENCODER_B);
encoder.setDistancePerPulse(RobotMap.ArmMap.DISTANCE_PER_PULSE);
encoder.setReverseDirection(RobotMap.ArmMap.INV_ENCODER);
upperLimit = new DigitalInput(RobotMap.ArmMap.DIO_LIMIT_TOP);
bottomLimit = new DigitalInput(RobotMap.ArmMap.DIO_LIMIT_BOTTOM);
setAbsoluteTolerance(0.05);
getPIDController().setContinuous(false);
}
示例2: DrivetrainSubsystem
import edu.wpi.first.wpilibj.Encoder; //導入方法依賴的package包/類
public DrivetrainSubsystem(){
leftMotor = RobotMap.leftDriveMotor.getController();
rightMotor = RobotMap.rightDriveMotor.getController();
drive = new RobotDrive(leftMotor, rightMotor);
accelerometer = new IntegratedBuiltinAccelerometer(Range.k2G);
leftEncoder = new Encoder(RobotMap.leftEncoder[0], RobotMap.leftEncoder[1]);
rightEncoder = new Encoder(RobotMap.rightEncoder[0], RobotMap.rightEncoder[1]);
leftEncoder.setReverseDirection(true);
rightEncoder.setReverseDirection(true);
driveGyro = new AnalogGyro(RobotMap.driveGyroPort);
driveGyro.reset();
driveGyro.setSensitivity(0.007);
}
示例3: init
import edu.wpi.first.wpilibj.Encoder; //導入方法依賴的package包/類
private void init() {
if (!initialized) {
flTalon = new Talon(RobotMap.DIGITAL_MODULE, RobotMap.FL_WHEEL);
frTalon = new Talon(RobotMap.DIGITAL_MODULE, RobotMap.FR_WHEEL);
blTalon = new Talon(RobotMap.DIGITAL_MODULE, RobotMap.BL_WHEEL);
brTalon = new Talon(RobotMap.DIGITAL_MODULE, RobotMap.BR_WHEEL);
System.out.println("Module: "+ RobotMap.DIGITAL_MODULE +" used for drive.");
System.out.println("FL wheel at: "+ RobotMap.FL_WHEEL +" FR wheel at: "+ RobotMap.FR_WHEEL);
System.out.println("BL wheel at: "+ RobotMap.BL_WHEEL +" BR wheel at: "+ RobotMap.BR_WHEEL);
// if (useRobotDrive)
robotDrive = new RobotDrive(flTalon, blTalon, frTalon, brTalon);
// else
// robotDrive = null;
aButton_Held = false;
driveForward = true;
SmartDashboard.putBoolean("Drive_Direction", driveForward);
leftEncoder = new Encoder(RobotMap.DIGITAL_MODULE, RobotMap.LEFT_ENCODER_A,
RobotMap.DIGITAL_MODULE, RobotMap.LEFT_ENCODER_B, true, CounterBase.EncodingType.k4X);
rightEncoder = new Encoder(RobotMap.DIGITAL_MODULE, RobotMap.RIGHT_ENCODER_A,
RobotMap.DIGITAL_MODULE, RobotMap.RIGHT_ENCODER_B, false, CounterBase.EncodingType.k4X);
// leftEncoder.setReverseDirection(false);
leftEncoder.setReverseDirection(true); // Flipped on comp bot
leftEncoder.setMinRate(10);
leftEncoder.setDistancePerPulse(6 * Math.PI / 250);
leftEncoder.start();
// rightEncoder.setReverseDirection(true);
rightEncoder.setReverseDirection(false); // Flipped on comp bot
rightEncoder.setMinRate(10);
rightEncoder.setDistancePerPulse(6 * Math.PI / 250);
rightEncoder.start();
gyro = new Gyro(RobotMap.ANALOG_MODULE, RobotMap.GYRO);
SmartDashboard.putNumber("Max turn speed", 1);
}
initialized = true;
}