Skip to content

Commit

Permalink
Added back open loop ramps and potential climber fix
Browse files Browse the repository at this point in the history
Modified cancoder offset
  • Loading branch information
gavinskycastle committed Mar 15, 2024
1 parent cd199b6 commit a4ef622
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/constants/ARM.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import edu.wpi.first.math.util.Units;

public final class ARM {
public static final double canCoderOffset = -0.035888671875;
public static final double canCoderOffset = 0.196533203125;
/* Static Feedforward Gain
This is added to the closed loop output. The sign is determined by target velocity.
The unit for this constant is dependent on the control mode,
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public Arm() {
config.ClosedLoopGeneral.ContinuousWrap = false;
config.MotorOutput.PeakForwardDutyCycle = ARM.maxOutput;
config.MotorOutput.PeakReverseDutyCycle = -ARM.maxOutput;

// Ramp rates for climbing
config.OpenLoopRamps.DutyCycleOpenLoopRampPeriod = 2.0;
config.OpenLoopRamps.TorqueOpenLoopRampPeriod = 2.0;
config.OpenLoopRamps.VoltageOpenLoopRampPeriod = 2.0;

config.MotionMagic.MotionMagicAcceleration = ARM.kAccel;
config.MotionMagic.MotionMagicCruiseVelocity = ARM.kCruiseVel;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/frc/robot/subsystems/Climber.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public Climber() {
CtreUtils.configureTalonFx(elevatorClimbMotors[1], config);

elevatorClimbMotors[0].setInverted(false);
elevatorClimbMotors[1].setControl(new Follower(elevatorClimbMotors[0].getDeviceID(), true));
elevatorClimbMotors[1].setInverted(true);
// elevatorClimbMotors[1].setControl(new Follower(elevatorClimbMotors[0].getDeviceID(), true));

SmartDashboard.putData(this);
}
Expand Down Expand Up @@ -138,7 +139,7 @@ private void setPercentOutput(double output, boolean enforceLimits) {
}

elevatorClimbMotors[0].set(output);
// elevatorClimbMotors[1].set(output);
elevatorClimbMotors[1].set(output);
}

public double getAvgCurrentDraw() {
Expand Down Expand Up @@ -269,6 +270,7 @@ public void periodic() {
switch (m_controlMode) {
case CLOSED_LOOP:
elevatorClimbMotors[0].setControl(m_request.withPosition(m_desiredPositionMeters));
elevatorClimbMotors[1].setControl(m_request.withPosition(m_desiredPositionMeters));
break;
case OPEN_LOOP:
default:
Expand Down

0 comments on commit a4ef622

Please sign in to comment.