添加intaker重力前馈(未启用)
This commit is contained in:
@@ -99,6 +99,7 @@ public final class Constants {
|
||||
public static final double intakeRotaterUpLimit = 0.0; // rotator上限角度
|
||||
public static final double intakeRotaterDownLimit = 0.0; // rotator下限角度
|
||||
public static final double intakeRotaterVelocity = 10; // rotater的速度(如果你用速度控制的话)
|
||||
public static final double IntakeRotaterGravityFF = 0.0; // 重力前馈增益(需要实测调整)
|
||||
|
||||
public static final Slot0Configs intakeGetterSlot0Configs = new Slot0Configs()
|
||||
.withKP(0.00).withKI(0.00).withKD(0.00)
|
||||
|
||||
@@ -77,6 +77,7 @@ public class RobotContainer {
|
||||
configueShooter();
|
||||
configueClimber();
|
||||
bingdingLED();
|
||||
configueIntaker();
|
||||
}
|
||||
|
||||
/* ====================== */
|
||||
|
||||
@@ -13,7 +13,7 @@ public class IntakerControls {
|
||||
private final IntakerSubsystem IntakerSubsystem;
|
||||
private final CommandXboxController controller;
|
||||
|
||||
private static final double ROTATER_STEP_PER_CYCLE = 0.00;
|
||||
//private static final double ROTATER_STEP_PER_CYCLE = 0.00;
|
||||
|
||||
public IntakerControls(IntakerSubsystem Intaker, CommandXboxController controller) {
|
||||
this.IntakerSubsystem = Intaker;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.ctre.phoenix6.controls.PositionVoltage;
|
||||
import com.ctre.phoenix6.controls.VelocityVoltage;
|
||||
import com.ctre.phoenix6.hardware.TalonFX;
|
||||
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc.robot.Constants;
|
||||
|
||||
@@ -18,6 +19,17 @@ public class IntakerSubsystem extends SubsystemBase{
|
||||
|
||||
private double intakeRotaterTargetPosition = 0.0;
|
||||
|
||||
public double getGravityFFVolts(){
|
||||
double intakerotaterPosition = getIntakerotaterPosition();
|
||||
double gravityFFVolts = Constants.Intaker.IntakeRotaterGravityFF * intakerotaterPosition;
|
||||
return gravityFFVolts;
|
||||
}
|
||||
|
||||
public void setIntakerRotaterVelocityRps(double IntakeRotaterTargetVelocity) {
|
||||
double gravityFeedforward = getGravityFFVolts();
|
||||
intakerotater.setControl(velocityRequest.withVelocity(IntakeRotaterTargetVelocity).withFeedForward(gravityFeedforward));// 重力前馈);
|
||||
}
|
||||
|
||||
public IntakerSubsystem() {
|
||||
//初始化rotater&getter
|
||||
intakegetter = new TalonFX(47);
|
||||
@@ -35,7 +47,6 @@ public class IntakerSubsystem extends SubsystemBase{
|
||||
}
|
||||
|
||||
intakeRotaterTargetPosition = targetPosition;
|
||||
|
||||
intakerotater.setControl(positionRequest.withPosition(targetPosition)); // 设置rotater位置(TalonFX 内部闭环 PID)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user