-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from ftc16072/intake_arm_code
Intake arm code
- Loading branch information
Showing
5 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/ftc16072/Mechanisms/IntakeArm.java
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,60 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.Mechanisms; | ||
|
||
import com.acmerobotics.dashboard.config.Config; | ||
import com.qualcomm.robotcore.hardware.HardwareMap; | ||
import com.qualcomm.robotcore.hardware.Servo; | ||
|
||
import org.firstinspires.ftc.teamcode.ftc16072.Tests.QQTest; | ||
import org.firstinspires.ftc.teamcode.ftc16072.Tests.TestTwoServos; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
@Config | ||
public class IntakeArm extends QQMechanism { | ||
//change values later | ||
public static double ARM_DROP_POSITION = 0.7; | ||
public static double ARM_INTAKE_POSITION = 0.9; | ||
public static double SEARCHING_POSITION = 0.85; | ||
public static double TRANSFER_POSITION = 0.8; | ||
Servo leftArmServo; | ||
Servo rightArmServo; | ||
|
||
@Override | ||
public void init(HardwareMap hwMap) { | ||
leftArmServo = hwMap.get(Servo.class, "left_arm_servo"); | ||
rightArmServo = hwMap.get(Servo.class, "right_arm_servo"); | ||
rightArmServo.setDirection(Servo.Direction.REVERSE); | ||
} | ||
public void goToPos(double position){ | ||
leftArmServo.setPosition(position); | ||
rightArmServo.setPosition(position); | ||
|
||
} | ||
public void goToDropPos(){ | ||
leftArmServo.setPosition(ARM_DROP_POSITION); | ||
rightArmServo.setPosition(ARM_DROP_POSITION); | ||
} | ||
public void goToIntake(){ | ||
leftArmServo.setPosition(ARM_INTAKE_POSITION); | ||
rightArmServo.setPosition(ARM_INTAKE_POSITION); | ||
} | ||
public void searching(){ | ||
leftArmServo.setPosition(SEARCHING_POSITION); | ||
rightArmServo.setPosition(SEARCHING_POSITION); | ||
} | ||
public void transfer(){ | ||
leftArmServo.setPosition(TRANSFER_POSITION); | ||
rightArmServo.setPosition(TRANSFER_POSITION); | ||
} | ||
|
||
|
||
|
||
@Override | ||
public List<QQTest> getTests() { | ||
return Arrays.asList( | ||
new TestTwoServos("arm_pos", ARM_DROP_POSITION, ARM_INTAKE_POSITION, leftArmServo, rightArmServo)); | ||
|
||
} | ||
} | ||
|
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
35 changes: 35 additions & 0 deletions
35
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/ftc16072/Tests/TestTwoServos.java
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,35 @@ | ||
package org.firstinspires.ftc.teamcode.ftc16072.Tests; | ||
|
||
import com.qualcomm.robotcore.hardware.Servo; | ||
|
||
import org.firstinspires.ftc.robotcore.external.Telemetry; | ||
|
||
public class TestTwoServos extends QQTest{ | ||
double onPosition; | ||
double offPosition; | ||
Servo servo; | ||
Servo servo2; | ||
|
||
public TestTwoServos(String name, double onPosition, double offPosition, Servo servo, Servo servo2){ | ||
super(name); | ||
this.onPosition = onPosition; | ||
this.offPosition = offPosition; | ||
this.servo = servo; | ||
this.servo2 = servo2; | ||
} | ||
@Override | ||
public void run(boolean on, Telemetry telemetry) { | ||
if(on){ | ||
servo.setPosition(onPosition); | ||
}else{ | ||
servo.setPosition(offPosition); | ||
} | ||
if(on){ | ||
servo2.setPosition(onPosition); | ||
}else{ | ||
servo2.setPosition(offPosition); | ||
} | ||
telemetry.addData("Position", servo.getPosition()); | ||
telemetry.addData("Position", servo2.getPosition()); | ||
} | ||
} |