This repository has been archived by the owner on Jan 19, 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.
- Loading branch information
1 parent
1841ce1
commit 7261626
Showing
7 changed files
with
97 additions
and
72 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
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,10 +1,8 @@ | ||
package org.firstinspires.ftc.teamcode; | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
|
||
@Autonomous(name = "LeftAuto", group = "opmode") | ||
public class LeftAuto extends EncoderAuto { | ||
@com.qualcomm.robotcore.eventloop.opmode.Autonomous(name = "LeftAuto", group = "opmode") | ||
public class LeftAuto extends Autonomous { | ||
public LeftAuto() { | ||
super(EncoderAuto.LEFT); | ||
super(Autonomous.LEFT); | ||
} | ||
} |
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,10 +1,8 @@ | ||
package org.firstinspires.ftc.teamcode; | ||
|
||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
|
||
@Autonomous(name = "RightAuto", group = "opmode") | ||
public class RightAuto extends EncoderAuto { | ||
@com.qualcomm.robotcore.eventloop.opmode.Autonomous(name = "RightAuto", group = "opmode") | ||
public class RightAuto extends Autonomous { | ||
public RightAuto() { | ||
super(EncoderAuto.RIGHT); | ||
super(Autonomous.RIGHT); | ||
} | ||
} |
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,52 @@ | ||
package org.firstinspires.ftc.teamcode.modules; | ||
|
||
import com.qualcomm.robotcore.hardware.HardwareMap; | ||
import com.qualcomm.robotcore.hardware.Servo; | ||
|
||
public class ServoPixel implements Modulable { | ||
public static final double CLOSED_POS = 0; | ||
private static final double OPENED_POS = 0.3; | ||
private final String name; | ||
private Servo servo; | ||
private boolean open; | ||
|
||
public ServoPixel(String name) { | ||
this.name = name; | ||
} | ||
|
||
public double getPosition() { | ||
return servo.getPosition(); | ||
} | ||
|
||
public void setPosition(double position) { | ||
servo.setPosition(position); | ||
} | ||
|
||
@Override | ||
public void init(HardwareMap map) { | ||
servo = map.get(Servo.class, name); | ||
} | ||
|
||
/** | ||
* Makes the servo start to move towards the specified position. | ||
* | ||
* @param open move towards open or close position | ||
*/ | ||
public void setOpen(boolean open) { | ||
this.open = open; | ||
startMove(); | ||
} | ||
|
||
/** | ||
* Start to move the claw opposite to the current state. | ||
*/ | ||
public void toggle() { | ||
open = !open; | ||
startMove(); | ||
} | ||
|
||
private void startMove() { | ||
servo.setPosition(open? OPENED_POS: CLOSED_POS); | ||
} | ||
} | ||
|
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