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

Phoenix6 update #3

Closed
wants to merge 59 commits into from
Closed

Phoenix6 update #3

wants to merge 59 commits into from

Conversation

Emma03L
Copy link
Contributor

@Emma03L Emma03L commented Dec 8, 2023

No description provided.

@Emma03L Emma03L requested review from katzuv and vichik123 December 8, 2023 11:36
Copy link
Member

@katzuv katzuv left a comment

Choose a reason for hiding this comment

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

Make sure to use the new configuration API to its fullest potential, it will make your code much cleaner.

src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOSim.java Outdated Show resolved Hide resolved
src/main/java/utils/units/Units.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOSim.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
@katzuv katzuv mentioned this pull request Dec 16, 2023
Copy link
Member

@katzuv katzuv left a comment

Choose a reason for hiding this comment

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

Greate fixes, just a few more!

src/main/java/frc/robot/swerve/ModuleIOSim.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIO.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOSim.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOSim.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveDriveInputs.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIO.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveDrive.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/ModuleIOReal.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveDrive.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveDrive.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveDrive.java Outdated Show resolved Hide resolved
build.gradle Show resolved Hide resolved
src/main/java/frc/robot/Ports.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveDrive.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/Main.java Outdated Show resolved Hide resolved
@katzuv
Copy link
Member

katzuv commented Jan 15, 2024

One comment left! #3 (comment)

Copy link
Contributor

@vichik123 vichik123 left a comment

Choose a reason for hiding this comment

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

This is beautiful code.

src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/swerve/SwerveConstants.java Outdated Show resolved Hide resolved
Copy link
Member

@katzuv katzuv left a comment

Choose a reason for hiding this comment

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

🎸 Good job!

Comment on lines +139 to +140
driveMotor.getConfigurator().apply(driveConfig.Slot0);
angleMotor.getConfigurator().apply(angleConfig.Slot0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry, I just have two last little things.

  1. It's not a very good idea to update the PID inside the motor every loop. You need to use the hasChanged method in the LoggedTunableNumber object.
  2. The Slot0 object is never updated, so the PID would never really change.

private final Integral driveSupplyChargeUsedCoulomb = new Integral();
private final Integral driveStatorChargeUsedCoulomb = new Integral();
private final Integral angleSupplyChargeUsedCoulomb = new Integral();
private final Integral angleStatorChargeUsedCoulomb = new Integral();
private final MotionMagicVoltage angleControlRequest =
new MotionMagicVoltage(0).withEnableFOC(true).withSlot(0);
private final PositionVoltage angleControlRequest =
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

We tried using the motion magic expo, and we tried normal motion magic. But in the end we found that regular position control is best.

@vichik123 vichik123 closed this Jan 16, 2024
@vichik123 vichik123 deleted the phoenix6-update branch January 16, 2024 19:16
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.

3 participants