This repository has been archived by the owner on Mar 17, 2024. 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
4 changed files
with
50 additions
and
14 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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 | ||
|
||
/** | ||
* An API to control the drone launcher. | ||
*/ | ||
object Drone : API() { | ||
private lateinit var pin: Servo | ||
|
||
override fun init(opMode: OpMode) { | ||
super.init(opMode) | ||
|
||
this.pin = this.opMode.hardwareMap.get(Servo::class.java, "pin") | ||
|
||
this.resetPin() | ||
} | ||
|
||
/** Moves the pin to the open position, releasing the drone. */ | ||
fun releasePin() { | ||
this.pin.position = RobotConfig.Drone.OPEN_PIN | ||
} | ||
|
||
/** Resets the pin to its default, closed, position. */ | ||
private fun resetPin() { | ||
this.pin.position = RobotConfig.Drone.CLOSE_PIN | ||
} | ||
} |
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