-
Notifications
You must be signed in to change notification settings - Fork 0
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
Climber Positions API + Rickaboot #148
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the encoders are being neglected here, I guess this is really just setting up more advanced features to use in the future, maybe this name should be changed since we aren't really going to positions, just setting up dirty work.
src/main/java/frc/robot/commands/climber/ClimberJoystickCommand.java
Outdated
Show resolved
Hide resolved
return leftMotor.getSelectedSensorPosition(); | ||
/** Public API */ | ||
|
||
private boolean isStringPotConnected() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our voltage without the stringpot might still be a value
src/main/java/frc/robot/commands/climber/ClimberJoystickCommand.java
Outdated
Show resolved
Hide resolved
src/main/java/frc/robot/commands/climber/ClimberJoystickCommand.java
Outdated
Show resolved
Hide resolved
I stayed up last night thinking about this, and I feel like we want the String Pot to be a luxury or periphery option instead of being our main focus for setting limits and positions. I feel like this is jumping through hoops in case the string pot breaks, where we should be able to write this so that it shouldn't matter if it breaks, it would just be nice to have. I think we need to step back and think about this in case we start merging a bunch of unnecessary code, i.e., we shouldn't have to rush this, we have three weeks until Livonia. |
da6406c
to
0bfedb5
Compare
a3de4f2
to
06a638b
Compare
// private static final double MAX_SPEED = 0.70; | ||
private static final double MAX_SPEED = 0.10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Test this low, merge this higher
private final AnalogInput stringPot = new AnalogInput(Constants.CLIMBER_STRING_POT_ID); | ||
private final TalonFX leftMotor = new TalonFX(Constants.CLIMBER_LEFT_MOTOR_ID); | ||
private final TalonFX rightMotor = new TalonFX(Constants.CLIMBER_RIGHT_MOTOR_ID); | ||
|
||
private static final double STRING_POT_UPPER_SOFT_LIMIT = 3.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Find our string pot upper limit - probably via driving with a joystick
private static final double STRING_POT_UPPER_SOFT_LIMIT = 3.0; | ||
private Double stringPotStartingVoltage; | ||
private double stringPotVoltage; | ||
private PIDController stringPotPIDController = new PIDController(0.1, 0.0, 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Be careful with this value - needs to be tuned. If anything, we might want to start this lower and start moving up as we go.
private double stringPotVoltage; | ||
private PIDController stringPotPIDController = new PIDController(0.1, 0.0, 0.0); | ||
|
||
private static final double ENCODER_UPPER_SOFT_LIMIT = 3000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Find our upper limit here (pull value for the same location we pull the value for the string pot)
private PIDController stringPotPIDController = new PIDController(0.1, 0.0, 0.0); | ||
|
||
private static final double ENCODER_UPPER_SOFT_LIMIT = 3000; | ||
private static final double ENCODER_LOWER_SOFT_LIMIT = 0; // Zero == where the motor boots |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- As mentioned, our lower limits will almost certainly be lower than this due to our "pull up".
if (setpointPosition.sensor == ClimberSensor.ENCODER) { | ||
// If we're using the encoders - set the internal encoder PID | ||
// to move us to our position | ||
setPosition(setpointPosition.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We need to have our range check here
// attempt to | ||
// hold the climber at the setpoint. The brake mode motors do that for us. | ||
if (stringPotPIDController.atSetpoint()) { | ||
// TODO: Hold at position? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- TODO? Worth talking with someone else to figure out if this is how we want this to work
stringPotStartingVoltage, | ||
ClimberSensor.STRING_POT | ||
); | ||
case RICKABOOT: // TODO: Figure out Rickaboot string pot voltage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- TODO
0.0, | ||
ClimberSensor.ENCODER | ||
); | ||
case RICKABOOT: // TODO: Figure out Rickaboot encoder value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- TODO
ad5b5c0
to
bf69584
Compare
bf69584
to
f051926
Compare
Manual is still not working, PID looks good.
// NOTE: This is temp, and should not be checked in to main | ||
operatorRightBumper.whenPressed(() -> climber.moveToSetpoint(ClimberSetpoint.RICKABOOT)); | ||
operatorRightBumper.whenReleased(() -> climber.moveToSetpoint(ClimberSetpoint.START)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Back this out before merge
private static final double STRING_POT_LOWER_SOFT_LIMIT = 0.1; | ||
|
||
private Double stringPotStartingVoltage; | ||
private PIDController stringPotPIDController = new PIDController(6.0, 0.0, 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This controller needs to be tuned some more. My guess is way more P + a bunch of D.
// configuration.nominalOutputForward = 0.1; | ||
// configuration.nominalOutputReverse = 0.1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Temp removed the nominal outputs while we're tuning the PID. I want to see what happens if we run without them. We might need them back in through for our position hold.
|
||
output = Math.copySign(Math.min(Math.abs(output), MAX_SPEED), output); | ||
|
||
SmartDashboard.putNumber("Climber Output", output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We can remove this once we have our PIDs tuned.
); | ||
case RICKABOOT: | ||
return new ClimberPosition( | ||
148500, // TODO: This needs to be fixed... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This needs to be re-configured with the climber at it's new start location (~0.9something v). We were also having issues last night where we weren't getting close to the encoder values we expected. Need to figure out why that is.
} | ||
} | ||
|
||
// TODO: Make private - provide some other method here to move via joystick control |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're gonna merge with this TODO - since we're not going to convert the climber joystick drive code right this moment.
The logic that we had currently had the boolean causing a stop and conflicting our motors. By removing this stop, and moving it into the actual periodicMoveToSetpoint, we can use the joystick and the PID. Also, adjusted the volatage we get when the stringpot is disconnected to be accurate.
This PR attempts to abstract the idea of moving the climber so we don't have to talk voltages or speeds directly. Instead, commands that want to move the climber call
moveToSetpoint
with a setpoint to move the climber automatically. Right now - only rickaboot and start are supported. Internally, the climber manages moving itself to the proper position either via the string pot or encoders.