-
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
21 changed files
with
291 additions
and
213 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
63 changes: 33 additions & 30 deletions
63
PathPlanning/src/main/kotlin/com/example/pathplanning/legacy/blue/basket/BlueHighBasket1.kt
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,32 +1,35 @@ | ||
package com.example.pathplanning.legacy.blue.basket | ||
|
||
//object BlueHighBasket1 { | ||
// @JvmStatic | ||
// fun main(args: Array<String>) { | ||
// val meepMeep = MeepMeep(800) | ||
// | ||
// val myBot = DefaultBotBuilder(meepMeep) // Set bot constraints: maxVel, maxAccel, maxAngVel, maxAngAccel, track width | ||
// .setConstraints(30.0, 30.0, Math.toRadians(170.0), Math.toRadians(170.0), 13.94) | ||
// .followTrajectorySequence { drive -> | ||
// drive.trajectorySequenceBuilder(Pose2d(-12.0, 62.0, (270.0).toRadians())) | ||
// .turn((90.0).toRadians()) | ||
// .forward(60.0) | ||
// .waitSeconds(2.0) | ||
// .build() | ||
// } | ||
// var img: Image? = null | ||
// try { | ||
// img = ImageIO.read(File("C://Users//arava//Downloads//field.png/")) | ||
// } catch (_ : IOException) { | ||
// | ||
// } | ||
// | ||
// if (img != null) { | ||
// meepMeep.setBackground(img) | ||
// .setDarkMode(true) | ||
// .setBackgroundAlpha(0.95f) | ||
// .addEntity(myBot) | ||
// .start() | ||
// } | ||
// } | ||
//} | ||
import com.acmerobotics.roadrunner.Pose2d | ||
import com.noahbres.meepmeep.MeepMeep | ||
import com.noahbres.meepmeep.core.toRadians | ||
import com.noahbres.meepmeep.roadrunner.DefaultBotBuilder | ||
|
||
object BlueHighBasket1 { | ||
@JvmStatic | ||
fun main(args: Array<String>) { | ||
val meepMeep = MeepMeep(800) | ||
|
||
val myBot = DefaultBotBuilder(meepMeep) // Set bot constraints: maxVel, maxAccel, maxAngVel, maxAngAccel, track width | ||
.setStartPose(Pose2d(12.0, 62.0, (270.0).toRadians())) | ||
.setConstraints(30.0, 30.0, Math.toRadians(170.0), Math.toRadians(170.0), 13.94) | ||
.build() | ||
|
||
myBot.runAction( | ||
myBot.drive.actionBuilder( | ||
Pose2d(12.0, 62.0, (270.0).toRadians()) | ||
) | ||
.turn((90.0).toRadians()) | ||
.lineToX(35.0) | ||
.waitSeconds(2.0) | ||
.build() | ||
) | ||
|
||
|
||
meepMeep.setBackground(MeepMeep.Background.FIELD_INTO_THE_DEEP_JUICE_DARK) | ||
.setDarkMode(true) | ||
.setBackgroundAlpha(0.95f) | ||
.addEntity(myBot) | ||
.start() | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/commands/ActionCommand.kt
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,33 @@ | ||
package org.firstinspires.ftc.teamcode.commands | ||
|
||
import com.acmerobotics.dashboard.FtcDashboard | ||
import com.acmerobotics.dashboard.telemetry.TelemetryPacket | ||
import com.acmerobotics.roadrunner.Action | ||
import com.arcrobotics.ftclib.command.CommandBase | ||
import com.arcrobotics.ftclib.command.Subsystem | ||
|
||
/** | ||
* Generic command that wraps Roadrunner 1.0 Actions | ||
*/ | ||
class ActionCommand( | ||
private val action: Action, | ||
private vararg val subsystem: Subsystem, | ||
private val endBehavior: () -> Unit = { }, | ||
) : CommandBase() { | ||
var finished = false | ||
|
||
override fun initialize() = addRequirements(*subsystem) | ||
|
||
override fun execute() { | ||
val packet = TelemetryPacket() | ||
|
||
action.preview(packet.fieldOverlay()) | ||
finished = !action.run(packet) | ||
|
||
FtcDashboard.getInstance().sendTelemetryPacket(packet) | ||
} | ||
|
||
override fun isFinished() = finished | ||
|
||
override fun end(interrupted: Boolean) = endBehavior.invoke() | ||
} |
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
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
7 changes: 0 additions & 7 deletions
7
TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/constants/PoseStorage.kt
This file was deleted.
Oops, something went wrong.
71 changes: 71 additions & 0 deletions
71
TeamCode/src/main/kotlin/org/firstinspires/ftc/teamcode/opModes/auto/GenericAuto.kt
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,71 @@ | ||
package org.firstinspires.ftc.teamcode.opModes.auto | ||
|
||
import com.acmerobotics.roadrunner.Pose2d | ||
import com.arcrobotics.ftclib.command.CommandOpMode | ||
import com.arcrobotics.ftclib.command.SequentialCommandGroup | ||
import com.arcrobotics.ftclib.command.WaitCommand | ||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous | ||
import org.firstinspires.ftc.teamcode.commands.ActionCommand | ||
import org.firstinspires.ftc.teamcode.commands.arm.ArmCommand | ||
import org.firstinspires.ftc.teamcode.commands.elevator.ElevatorCommand | ||
import org.firstinspires.ftc.teamcode.commands.intake.IntakeCommand | ||
import org.firstinspires.ftc.teamcode.constants.AutoStartPose | ||
import org.firstinspires.ftc.teamcode.subsystems.arm.ArmSubsystem | ||
import org.firstinspires.ftc.teamcode.subsystems.drive.DriveSubsystem | ||
import org.firstinspires.ftc.teamcode.subsystems.intake.IntakeSubsystem | ||
import org.firstinspires.ftc.teamcode.subsystems.slides.ElevatorSubsystem | ||
|
||
@Autonomous(name = "Generic Auto") | ||
class GenericAuto : CommandOpMode() { | ||
override fun initialize() { | ||
DriveSubsystem.initialize(hardwareMap) | ||
ArmSubsystem.initialize(hardwareMap) | ||
ElevatorSubsystem.initialize(hardwareMap) | ||
IntakeSubsystem.initialize(hardwareMap) | ||
|
||
val scorePreloaded = | ||
SequentialCommandGroup( | ||
ActionCommand( | ||
DriveSubsystem.actionBuilder(AutoStartPose.BLUE_LEFT::startPose) | ||
.splineToLinearHeading( | ||
Pose2d(54.0, 56.0, Math.toRadians(225.0)), | ||
Math.toRadians(0.0) | ||
) | ||
.build(), | ||
DriveSubsystem | ||
), | ||
ArmCommand(90.0, ArmSubsystem), | ||
ElevatorCommand(30.0, ElevatorSubsystem), | ||
IntakeCommand(true, IntakeSubsystem), | ||
WaitCommand(500), | ||
IntakeCommand(false, IntakeSubsystem), | ||
ElevatorCommand(0.0, ElevatorSubsystem), | ||
ArmCommand(0.0, ArmSubsystem), | ||
) | ||
|
||
val scoreFirst = | ||
SequentialCommandGroup( | ||
ActionCommand( | ||
DriveSubsystem.actionBuilder(DriveSubsystem::pose) | ||
.turn(Math.toRadians(37.0)) | ||
.build(), | ||
DriveSubsystem | ||
), | ||
ElevatorCommand(20.0, ElevatorSubsystem), | ||
IntakeCommand(true, IntakeSubsystem), | ||
WaitCommand(500), | ||
IntakeCommand(false, IntakeSubsystem), | ||
ElevatorCommand(0.0, ElevatorSubsystem), | ||
ArmCommand(90.0, ArmSubsystem), | ||
ElevatorCommand(30.0, ElevatorSubsystem) | ||
) | ||
|
||
schedule( | ||
scorePreloaded | ||
.andThen( | ||
scoreFirst | ||
) | ||
) | ||
} | ||
|
||
} |
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
Oops, something went wrong.