本文整理汇总了Java中com.ctre.CANTalon.setPID方法的典型用法代码示例。如果您正苦于以下问题:Java CANTalon.setPID方法的具体用法?Java CANTalon.setPID怎么用?Java CANTalon.setPID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ctre.CANTalon
的用法示例。
在下文中一共展示了CANTalon.setPID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Drivebase
import com.ctre.CANTalon; //导入方法依赖的package包/类
public Drivebase() {
super();
left = new CANTalon(FRONT_LEFT_MOTOR_DEVICE_NUMBER);
leftSlave = new CANTalon(BACK_LEFT_MOTOR_DEVICE_NUMBER);
leftSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
leftSlave.set(FRONT_LEFT_MOTOR_DEVICE_NUMBER);
right = new CANTalon(FRONT_RIGHT_MOTOR_DEVICE_NUMBER);
rightSlave = new CANTalon(BACK_RIGHT_MOTOR_DEVICE_NUMBER);
rightSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
rightSlave.set(FRONT_RIGHT_MOTOR_DEVICE_NUMBER);
left.setInverted(true);
right.setInverted(true);
leftSlave.setInverted(true);
rightSlave.setInverted(true);
left.setFeedbackDevice(CANTalon.FeedbackDevice.QuadEncoder);
right.setFeedbackDevice(CANTalon.FeedbackDevice.QuadEncoder);
left.configEncoderCodesPerRev(TICS_PER_REVOLUTION);
right.configEncoderCodesPerRev(TICS_PER_REVOLUTION);
left.reverseSensor(true);
right.reverseSensor(true);
// PID Stuff
left.setPID(0.1, 0, 0, 0.025, 0, 1, 0);
right.setPID(0.1, 0, 0, 0.025, 0, 1, 0);
left.configNominalOutputVoltage(+0, -0);
right.configPeakOutputVoltage(+12, -12);
left.setProfile(0);
right.setProfile(0);
robotDrive = new RobotDrive(left, right);
}
示例2: updateCANTalonSRX
import com.ctre.CANTalon; //导入方法依赖的package包/类
/**
* Helper method for processing a CANTalonOutput for an SRX
*/
private void updateCANTalonSRX(CANTalon talon, CANTalonOutput output) {
talon.changeControlMode(output.getControlMode());
if(output.getControlMode().isPID() || output.getControlMode() == TalonControlMode.MotionMagic) {
talon.setPID(output.gains.P, output.gains.I, output.gains.D, output.gains.F, output.gains.izone, output.gains.rampRate, output.profile);
}
if (output.getControlMode() == CANTalon.TalonControlMode.MotionMagic) {
talon.setMotionMagicAcceleration(output.accel);
talon.setMotionMagicCruiseVelocity(output.cruiseVel);
}
talon.set(output.getSetpoint());
}
示例3: configure
import com.ctre.CANTalon; //导入方法依赖的package包/类
@Override
public void configure(@NotNull CANTalon talon) {
talon.configMaxOutputVoltage(valueOrElse(outputVoltageMax, 12));
talon.setCloseLoopRampRate(closedLoopRampRate != null ? closedLoopRampRate : 0);
talon.configPeakOutputVoltage(
valueOrElse(forwardOutputVoltagePeak, 12), valueOrElse(reverseOutputVoltagePeak, -12));
talon.configNominalOutputVoltage(
valueOrElse(forwardOutputVoltageNominal, 0), valueOrElse(reverseOutputVoltageNominal, 0));
talon.setAllowableClosedLoopErr(valueOrElse(allowableClosedLoopError, 0));
talon.setNominalClosedLoopVoltage(valueOrElse(nominalClosedLoopVoltage, 0));
talon.setPID(valueOrElse(pGain, 0), valueOrElse(iGain, 0), valueOrElse(dGain, 0));
talon.setF(valueOrElse(fGain, 0));
talon.setIZone(valueOrElse(iZone, 0));
super.configure(talon);
}