本文整理汇总了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;
}