This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
-
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.
Co-authored-by: Vifi5 <117041326+Vif15@users.noreply.github.com>
- Loading branch information
Showing
12 changed files
with
158 additions
and
102 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
22 changes: 9 additions & 13 deletions
22
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/api/Drone.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,28 @@ | ||
package org.firstinspires.ftc.teamcode.api | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.OpMode | ||
import com.qualcomm.robotcore.hardware.DcMotor | ||
import com.qualcomm.robotcore.hardware.DcMotorSimple | ||
import com.qualcomm.robotcore.hardware.Servo | ||
import org.firstinspires.ftc.teamcode.utils.RobotConfig | ||
|
||
/** | ||
* An API to control the drone launcher. | ||
*/ | ||
object Drone : API() { | ||
private lateinit var droneLeft: DcMotor | ||
private lateinit var droneRight: DcMotor | ||
private lateinit var hook: Servo | ||
|
||
override fun init(opMode: OpMode) { | ||
super.init(opMode) | ||
|
||
this.droneLeft = this.opMode.hardwareMap.get(DcMotor::class.java, "droneLeft") | ||
this.droneRight = this.opMode.hardwareMap.get(DcMotor::class.java, "droneRight") | ||
this.hook = opMode.hardwareMap.get(Servo::class.java, "droneHook") | ||
|
||
this.droneRight.direction = DcMotorSimple.Direction.REVERSE | ||
this.reset() | ||
} | ||
|
||
fun spin() { | ||
this.droneLeft.power = 1.0 | ||
this.droneRight.power = 1.0 | ||
fun release() { | ||
this.hook.position = RobotConfig.Drone.OPEN_PIN | ||
} | ||
|
||
fun stop() { | ||
this.droneLeft.power = 0.0 | ||
this.droneRight.power = 0.0 | ||
fun reset() { | ||
this.hook.position = RobotConfig.Drone.CLOSE_PIN | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/api/Hook.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,30 @@ | ||
package org.firstinspires.ftc.teamcode.api | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.OpMode | ||
import com.qualcomm.robotcore.hardware.DcMotor | ||
import com.qualcomm.robotcore.hardware.DcMotorSimple | ||
|
||
/** An API for controlling the hook, used to hang the robot. */ | ||
object Hook : API() { | ||
lateinit var hook: DcMotor | ||
private set | ||
|
||
override fun init(opMode: OpMode) { | ||
super.init(opMode) | ||
|
||
this.hook = this.opMode.hardwareMap.get(DcMotor::class.java, "hook") | ||
|
||
hook.direction = DcMotorSimple.Direction.REVERSE | ||
hook.mode = DcMotor.RunMode.RUN_WITHOUT_ENCODER | ||
hook.zeroPowerBehavior = DcMotor.ZeroPowerBehavior.BRAKE | ||
} | ||
|
||
fun moveHook(power: Double) { | ||
// TODO: Add limits based on encoders | ||
hook.power = power | ||
} | ||
|
||
fun stop() { | ||
hook.power = 0.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
25 changes: 25 additions & 0 deletions
25
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/api/PixelPlacer.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,25 @@ | ||
package org.firstinspires.ftc.teamcode.api | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.OpMode | ||
import com.qualcomm.robotcore.hardware.Servo | ||
import org.firstinspires.ftc.teamcode.utils.RobotConfig | ||
|
||
object PixelPlacer : API() { | ||
private lateinit var pixelPlacer: Servo | ||
|
||
override fun init(opMode: OpMode) { | ||
super.init(opMode) | ||
|
||
this.pixelPlacer = this.opMode.hardwareMap.get(Servo::class.java, "pixelPlacer") | ||
|
||
this.reset() | ||
} | ||
|
||
fun place() { | ||
pixelPlacer.position = RobotConfig.PixelPlacer.PLACE_POSITION | ||
} | ||
|
||
fun reset() { | ||
pixelPlacer.position = RobotConfig.PixelPlacer.DEFAULT_POSITION | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/autonomous/MoreJankAuto.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,34 @@ | ||
package org.firstinspires.ftc.teamcode.opmode.autonomous | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode | ||
import org.firstinspires.ftc.teamcode.api.Telemetry | ||
import org.firstinspires.ftc.teamcode.api.TriWheels | ||
import org.firstinspires.ftc.teamcode.api.linear.Encoders | ||
import org.firstinspires.ftc.teamcode.utils.RobotConfig | ||
|
||
@Autonomous(name = "Most Jank Auto") | ||
class MoreJankAuto : LinearOpMode() { | ||
private val forward = | ||
when (RobotConfig.model) { | ||
RobotConfig.Model.RobotA -> Encoders.Direction.Green | ||
RobotConfig.Model.RobotB -> Encoders.Direction.Red | ||
} | ||
|
||
override fun runOpMode() { | ||
Telemetry.init(this) | ||
TriWheels.init(this) | ||
Encoders.init(this) | ||
|
||
Telemetry.sayInitialized() | ||
|
||
waitForStart() | ||
|
||
Telemetry.sayStarted() | ||
|
||
Encoders.driveTo( | ||
forward, | ||
42.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
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.