Skip to content

Commit 4524ffa

Browse files
committed
added reset() in PathDriveCommand
1 parent eb7c83d commit 4524ffa

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/main/java/frc/robot/CommandComposer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ distanceTolerance, angleTolerance, pose(0.0, 0, 0)).withTimeout(1),
155155
*
156156
* @return a {@code Command} for moving the robot on a circle
157157
*/
158-
public static Command moveOnEllipse(double radius, double initialAngularIncrement, double finalAngularIncrement,
158+
public static Command moveOnOval(double radius, double initialAngularIncrement, double finalAngularIncrement,
159159
double distanceTolerance, double angleTolerance, double intermediateToleranceRatio, int poseCount) {
160160
Rotation2d angle = Rotation2d.kZero;
161161
var l = new LinkedList<Pose2d>();

src/main/java/frc/robot/Robot.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public Robot() {
7474
CommandComposer.moveForwardBackward2Controllers(6, distanceTolerance, angleToleranceInDegrees));
7575
m_testSelector
7676
.addOption(
77-
"Check PID Constants for Driving (Ellipe with Max Radius of 1m)",
78-
CommandComposer.moveOnEllipse(
77+
"Check PID Constants for Driving (Oval with Max Radius of 1m)",
78+
CommandComposer.moveOnOval(
7979
1, 8, 16, distanceTolerance, angleToleranceInDegrees, 16, 360 / 12 * 3 / 2));
8080
m_testSelector
8181
.addOption(

src/main/java/frc/robot/commands/PathDriveCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public PathDriveCommand(DriveSubsystem driveSubsystem,
7070
*/
7171
@Override
7272
public void initialize() {
73+
targetPoseSupplier().reset();
7374
moveToNextTargetPose();
7475
Pose2d pose = m_driveSubsystem.getPose();
7576
m_controllerXY.reset(m_targetPose.minus(pose).getTranslation().getNorm());
@@ -169,6 +170,13 @@ public IterativeTargetPoseSupplier(List<Supplier<Pose2d>> targetPoseSuppliers) {
169170
m_targetPoseSuppliers = targetPoseSuppliers;
170171
}
171172

173+
/**
174+
* Resets this {@code IterativeTargetPoseSupplier}.
175+
*/
176+
public void reset() {
177+
m_targetPoseIndex = 0;
178+
}
179+
172180
/**
173181
* Returns the curent target {@code Pose2d}.
174182
*

0 commit comments

Comments
 (0)