Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created Climb Subsystem #15

Closed
wants to merge 4 commits into from
Closed

Created Climb Subsystem #15

wants to merge 4 commits into from

Conversation

Yumnah2
Copy link
Contributor

@Yumnah2 Yumnah2 commented Jan 23, 2024

Created Climb Subsystem

Yumnah2 and others added 4 commits January 22, 2024 17:58
Created Climb Subsystem
Adding PID to climb, changed to CANSparkFlex
i fixed it :DDDD

(bugfixing lol)
@jamesdooley4
Copy link
Member

@Yumnah2 - need to fix spotlessJavaCheck failures.

Comment on lines +31 to +32
private final SparkAbsoluteEncoder encoderLeft;
private final SparkAbsoluteEncoder encoderRight;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should delete these, as the absolute encoder is only useful for measuring less than a single turn. Assuming climb rotates more than one turn, the RelativeEncoder returned from motorLeft.getEncoder() is what will need to be used.

motorLeftPIDController.setFeedbackDevice(encoderLeft);
motorRightPIDController.setFeedbackDevice(encoderRight);

//motor configuration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to also reset to factory default, set inverted mode (or not), set current limits, and burn configuration to flash so it persists across power loss. See https://github.com/robototes/ChargedUp2023/blob/f25191718390d11df9ddda789a0f0d5c35686734/src/main/java/frc/team2412/robot/subsystems/IntakeSubsystem.java#L124 for an example

}

public void setMotorDown() {
setMotor(-RETRACT_SPEED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RETRACT_SPEED is already defined as negative above, so shouldn't be inverted again here.

Comment on lines +72 to +74
public void setMotorUp() {
setMotor(EXTEND_SPEED);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI that when climbing at the edges (where the chain will be much higher on one side of the robot than the other), the left & right climb motors may need to go up to different heights. Fine to assume climbing in the middle with both sides going to the same level, but the controls may need to be more complex later to handle cases where left & right sides need to go up to different heights.

motorRight.set(speed);
}

public void stopArm() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename for climb. Maybe just stop()

@@ -0,0 +1,5 @@
package motorRight;

public class getAbsoluteEncoder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete extraneous file

Comment on lines +110 to +113
public void climb(double rotations) {
motorLeftPIDController.setReference(rotations, ControlType.kPosition);
motorRightPIDController.setReference(rotations, ControlType.kPosition);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what happens when using both the built-in PID controller (by setting the reference value here) and also setting a raw power (the .set() commands above). Having the ability to specify a raw power when retracting the climb arms has been useful in the past. But for extension, it'd likely be better to just use .setReference() so the units are in "amount being extended" instead of "speed of extension".


//calculate height climbed
//reset encoder to 0 if reset == true
public void resetEncoder(boolean reset) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the intented purpose of the reset parameter here? Could omit it and only call resetEncoder() when the encoder needs to be reset.

Comment on lines +102 to +103
encoderLeft.setPositionConversionFactor(0);
encoderRight.setPositionConversionFactor(0);
Copy link
Contributor

@TAKBS2412 TAKBS2412 Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this factor is multiplied by the raw value from the encoder (docs), this will make the encoder always return a position of 0, even after moving.

@iamawesomecat
Copy link
Contributor

no more climb :C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants