This repository was archived by the owner on May 19, 2024. It is now read-only.
File tree 3 files changed +13
-0
lines changed
src/main/java/frc/robot/swerve
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 8
8
import edu .wpi .first .wpilibj .shuffleboard .ShuffleboardLayout ;
9
9
import edu .wpi .first .wpilibj .shuffleboard .ShuffleboardTab ;
10
10
import edu .wpi .first .wpilibj2 .command .Command ;
11
+ import edu .wpi .first .wpilibj2 .command .Commands ;
11
12
import edu .wpi .first .wpilibj2 .command .button .CommandXboxController ;
12
13
import frc .lib .Subsystem ;
13
14
import frc .lib .Telemetry ;
@@ -94,6 +95,8 @@ public void addToShuffleboard(ShuffleboardTab tab) {
94
95
"Setpoint Angle (deg)" , () -> swerveModule .getSetpoint ().angle .getDegrees ());
95
96
swerveModuleColumn .addDouble (
96
97
"Setpoint Velocity (mps)" , () -> swerveModule .getSetpoint ().speedMetersPerSecond );
98
+
99
+ swerveModuleColumn .add (Commands .runOnce (swerveModule ::syncSteerPosition ).withName ("Sync Steer" ));
97
100
}
98
101
}
99
102
Original file line number Diff line number Diff line change 7
7
/** Swerve module hardware interface. */
8
8
public interface SwerveModuleIO {
9
9
10
+ /**
11
+ * Sets the steer motor's position to the azimuth encoder's position.
12
+ */
13
+ public void syncSteerPosition ();
14
+
10
15
/**
11
16
* Gets the state of the swerve module.
12
17
*
Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ public SwerveModuleIOCustom(SwerveModuleConfig config) {
52
52
53
53
setpoint = new SwerveModuleState ();
54
54
55
+ syncSteerPosition ();
56
+ }
57
+
58
+ @ Override
59
+ public void syncSteerPosition () {
55
60
azimuthEncoder .update (azimuthEncoderValues );
56
61
steerMotor .setPosition (azimuthEncoderValues .positionRotations );
57
62
}
You can’t perform that action at this time.
0 commit comments