-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
125 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.rambots.auto | ||
|
||
import com.pathplanner.lib.path.PathConstraints | ||
import edu.wpi.first.math.geometry.Pose2d | ||
import edu.wpi.first.math.geometry.Rotation2d | ||
import edu.wpi.first.math.geometry.Translation2d | ||
import edu.wpi.first.math.util.Units | ||
import org.rambots.util.AllianceFlipUtil | ||
|
||
object AutoConstants { | ||
|
||
val pathConstraints = PathConstraints(4.33, 8.0, Units.degreesToRadians(540.0), Units.degreesToRadians(720.0)) | ||
|
||
val ampScorePose: Pose2d get() = AllianceFlipUtil.apply(Pose2d(Translation2d(1.82, 7.7), Rotation2d.fromDegrees(-90.0))) | ||
|
||
val sourceDirectIntake get() = SourcePosePositions( | ||
AllianceFlipUtil.apply(Pose2d(Translation2d(15.92, 1.22), Rotation2d.fromDegrees(120.0))), | ||
AllianceFlipUtil.apply(Pose2d(Translation2d(15.42, 0.93), Rotation2d.fromDegrees(120.0))), | ||
AllianceFlipUtil.apply(Pose2d(Translation2d(14.95, 0.64), Rotation2d.fromDegrees(120.0))) | ||
) | ||
|
||
val sourceGroundIntake get() = SourcePosePositions( | ||
AllianceFlipUtil.apply(Pose2d(Translation2d(1.82, 7.7), Rotation2d.fromDegrees(120.0))), | ||
AllianceFlipUtil.apply(Pose2d(Translation2d(1.82, 7.7), Rotation2d.fromDegrees(120.0))), | ||
AllianceFlipUtil.apply(Pose2d(Translation2d(1.82, 7.7), Rotation2d.fromDegrees(120.0))) | ||
) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.rambots.auto | ||
|
||
import edu.wpi.first.math.geometry.Pose2d | ||
|
||
data class SourcePosePositions( | ||
val left: Pose2d, | ||
val center: Pose2d, | ||
val right: Pose2d | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
package org.rambots.commands | ||
|
||
import com.pathplanner.lib.auto.AutoBuilder | ||
import edu.wpi.first.wpilibj2.command.Command | ||
import edu.wpi.first.wpilibj2.command.Commands | ||
import org.rambots.auto.AutoConstants | ||
|
||
class AmpScoring: Command() { | ||
|
||
private val pathRun get() = AutoBuilder.pathfindToPose(AutoConstants.ampScorePose, AutoConstants.pathConstraints) | ||
private var scoreCommand = Commands.sequence(pathRun) | ||
|
||
override fun initialize() { | ||
super.initialize() | ||
} | ||
|
||
override fun execute() { | ||
super.execute() | ||
scoreCommand = Commands.sequence(pathRun) | ||
scoreCommand.schedule() | ||
} | ||
|
||
override fun end(interrupted: Boolean) { | ||
super.end(interrupted) | ||
scoreCommand.cancel() | ||
} | ||
|
||
override fun isFinished(): Boolean { | ||
return super.isFinished() | ||
return scoreCommand.isFinished | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.rambots.commands | ||
|
||
import com.pathplanner.lib.auto.AutoBuilder | ||
import edu.wpi.first.wpilibj2.command.Command | ||
import edu.wpi.first.wpilibj2.command.Commands | ||
import org.rambots.auto.AutoConstants | ||
|
||
class SourceIntake: Command() { | ||
private val pathRun get() = AutoBuilder.pathfindToPose(AutoConstants.sourceDirectIntake.left, AutoConstants.pathConstraints) | ||
private var scoreCommand = Commands.sequence(pathRun) | ||
|
||
override fun initialize() { | ||
super.initialize() | ||
scoreCommand = Commands.sequence(pathRun) | ||
scoreCommand.schedule() | ||
} | ||
|
||
override fun end(interrupted: Boolean) { | ||
super.end(interrupted) | ||
scoreCommand.cancel() | ||
} | ||
|
||
override fun isFinished(): Boolean { | ||
return scoreCommand.isFinished | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters