Skip to content

Commit

Permalink
fix drivetrain zeroing
Browse files Browse the repository at this point in the history
  • Loading branch information
sswadkar committed Mar 2, 2024
1 parent b5ab4ea commit 9ae44c7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FourNoteAutoPath(val drivetrain: Drivetrain, val superstructure: Superstru
)
)
},
keepTrapping = true
keepTrapping = false
),
WaitCommand(0.5).andThen(superstructure.groundIntakeCommand())
),
Expand Down Expand Up @@ -97,7 +97,7 @@ class FourNoteAutoPath(val drivetrain: Drivetrain, val superstructure: Superstru
)
)
},
keepTrapping = true
keepTrapping = false
),
WaitCommand(1.0).andThen(superstructure.groundIntakeCommand())
),
Expand Down Expand Up @@ -148,7 +148,7 @@ class FourNoteAutoPath(val drivetrain: Drivetrain, val superstructure: Superstru
) // Subwoofer
)
},
keepTrapping = true
keepTrapping = false
),
WaitCommand(0.5).andThen(superstructure.groundIntakeCommand())
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ private constructor(
if (keepTrapping) {
swerveDriveController.setTolerance(Pose2d(3.inches, 3.inches, 2.5.degrees).pose2d)
} else {
swerveDriveController.setTolerance(Pose2d(6.inches, 6.inches, 5.degrees).pose2d)
swerveDriveController.setTolerance(Pose2d(6.inches, 6.inches, 10.degrees).pose2d)
}
}

Expand Down Expand Up @@ -420,8 +420,8 @@ private constructor(
override fun isFinished(): Boolean {
trajCurTime = Clock.fpgaTime - trajStartTime
return endPathOnceAtReference &&
(swerveDriveController.atReference()) &&
trajCurTime > trajectoryGenerator.driveTrajectory.totalTimeSeconds.seconds
((swerveDriveController.atReference()) &&
trajCurTime > trajectoryGenerator.driveTrajectory.totalTimeSeconds.seconds)
}

override fun end(interrupted: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ class Drivetrain(val gyroIO: GyroIO, swerveModuleIOs: DrivetrainIO) : SubsystemB
val allianceFlippedDriveVector =
Pair(driveVector.first * flipDrive, driveVector.second * flipDrive)

Logger.recordOutput("Drivetrain/driveVectorFirst", allianceFlippedDriveVector.first.inMetersPerSecond)
Logger.recordOutput("Drivetrain/driveVectorSecond", allianceFlippedDriveVector.second.inMetersPerSecond)

val swerveModuleStates: Array<SwerveModuleState>
var desiredChassisSpeeds: ChassisSpeeds

Expand All @@ -435,7 +438,7 @@ class Drivetrain(val gyroIO: GyroIO, swerveModuleIOs: DrivetrainIO) : SubsystemB
allianceFlippedDriveVector.first,
allianceFlippedDriveVector.second,
angularVelocity,
odomTRobot.rotation
odomTField.rotation
)
} else {
desiredChassisSpeeds =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,8 @@ class Superstructure(

fun groundIntakeCommand(): Command {
val returnCommand =
runOnce { currentRequest = Request.SuperstructureRequest.GroundIntake() }.until {
isAtRequestedState && currentState == SuperstructureStates.GROUND_INTAKE
}
runOnce { currentRequest = Request.SuperstructureRequest.GroundIntake() }

returnCommand.name = "GroundIntakeCommand"
return returnCommand
}
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/team4099/robot2023/util/FMSData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ object FMSData {

val isBlue: Boolean
get() = DriverStation.getAlliance().get() == DriverStation.Alliance.Blue

}

0 comments on commit 9ae44c7

Please sign in to comment.