Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Migrate to Phoenix 6 #31

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Migrate to Phoenix 6 #31

wants to merge 7 commits into from

Conversation

rkanemoto
Copy link
Contributor

@rkanemoto rkanemoto commented Aug 23, 2023

Closes #17
Closes #18
Closes #19
Closes #20
Closes #21

: InvertedValue.CounterClockwise_Positive;

motorConfig.CurrentLimits.SupplyCurrentLimit = 15;
motorConfig.CurrentLimits.SupplyCurrentLimit = 15;
Copy link
Member

Choose a reason for hiding this comment

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

this line is identical to the one above

} else {
motor.set(TalonFXControlMode.PercentOutput, 0);
motor.set(0);
Copy link
Member

Choose a reason for hiding this comment

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

would prefer to do motor.disable() for these cases


driveMotorConfigs.Slot0.kP = Config.SWERVE_DRIVE_KP;
driveMotorConfigs.Slot0.kI = Config.SWERVE_DRIVE_KI;
driveMotorConfigs.Slot0.kD = Config.SWERVE_DRIVE_KD;
driveMotorConfigs.Slot0.kV = Config.SWERVE_DRIVE_KV;
driveMotorConfigs.Slot0.kS = Config.SWERVE_DRIVE_KS;

driveMotorConfigs.Feedback.FeedbackRemoteSensorID = encoder.getDeviceID();
driveMotorConfigs.Feedback.FeedbackSensorSource = FeedbackSensorSourceValue.FusedCANcoder;
Copy link
Member

Choose a reason for hiding this comment

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

we are probably supposed to set this on the steer motor, not the drive motor

@@ -67,7 +74,7 @@ public void startHoming() {

public void resetHoming() {
homingState = HomingState.NOT_HOMED;
motor.set(TalonFXControlMode.PercentOutput, 0);
motor.set(0);
Copy link
Member

Choose a reason for hiding this comment

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

would prefer motor.disable(). if you could actually do a project wide find and replace for these, that would be good

setAngle(Positions.STOWED.angle);
homingState = HomingState.HOMED;
}
} else if (homingState == HomingState.HOMED) {
motor.set(ControlMode.MotionMagic, goalAngle.getRotations() * 2048 * Config.WRIST_GEARING);
motor.set(goalAngle.getRotations() * 2048 * Config.WRIST_GEARING);
Copy link
Member

@jonahsnider jonahsnider Aug 23, 2023

Choose a reason for hiding this comment

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

this is a bug. you are

  1. converting for sensor units
  2. using a position to set a voltage
  3. applying gearing ratios in code

instead, we should be using a motion magic control request here

motor.set(TalonFXControlMode.PercentOutput, 0);
motor.setSelectedSensorPosition(
Config.WRIST_HOMED_ANGLE.getRotations() * 2048.0 * Config.WRIST_GEARING);
// motor.disable();
Copy link
Member

Choose a reason for hiding this comment

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

this should be uncommented


if (Config.IS_DEVELOPMENT) {
Logger.getInstance().recordOutput("Wrist/RawAngle", motor.getSelectedSensorPosition());
Logger.getInstance().recordOutput("Wrist/RawAngle", motor.getPosition().getValue());
Copy link
Member

Choose a reason for hiding this comment

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

remove this log, it's redundant with the other position/angle log

@@ -110,10 +125,9 @@ public void robotPeriodic() {
Logger.getInstance().recordOutput("Wrist/GoalAngle", goalAngle.getDegrees());
Logger.getInstance().recordOutput("Wrist/Homing", homingState.toString());

Logger.getInstance().recordOutput("Wrist/Voltage", motor.getMotorOutputVoltage());
Logger.getInstance().recordOutput("Wrist/Voltage", motor.getDutyCycle().getValue());
Copy link
Member

Choose a reason for hiding this comment

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

we should rename this field to Wrist/DutyCycleOut

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants