mirror of
https://github.com/TimeCrafters/FreightFrenzy.git
synced 2025-12-13 05:02:34 +00:00
Compare commits
2 Commits
a5be174760
...
c6096586e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6096586e1 | ||
|
|
bca0751f0e |
@@ -76,11 +76,9 @@ public class Robot {
|
||||
collectorArmRiser, collectorArmBobbin, depositorArmRiser, depositorArmBobbin;
|
||||
|
||||
// Collector
|
||||
public DcMotor collectorBobbin;
|
||||
public Servo collectorDispenser;
|
||||
|
||||
// Depositor
|
||||
public DcMotor depositorBobbin;
|
||||
public Servo depositorDispenser;
|
||||
|
||||
public Robot(CyberarmEngine engine) {
|
||||
@@ -93,8 +91,8 @@ public class Robot {
|
||||
initCollector();
|
||||
initDepositor();
|
||||
initCarousel();
|
||||
initVuforia();
|
||||
initTensorflow();
|
||||
// initVuforia();
|
||||
// initTensorflow();
|
||||
}
|
||||
|
||||
public double heading() {
|
||||
@@ -195,17 +193,23 @@ public class Robot {
|
||||
driveGoalRight = engine.hardwareMap.dcMotor.get("driveGoalRight");
|
||||
driveGoalLeft = engine.hardwareMap.dcMotor.get("driveGoalLeft");
|
||||
|
||||
driveWarehouseLeft.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||
driveGoalLeft.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||
driveWarehouseLeft.setDirection(DcMotorSimple.Direction.FORWARD);
|
||||
driveWarehouseRight.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||
|
||||
driveGoalLeft.setDirection(DcMotorSimple.Direction.FORWARD);
|
||||
driveGoalRight.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||
}
|
||||
|
||||
private void initCollector() {
|
||||
collectorArmBobbin = engine.hardwareMap.dcMotor.get("collectorArmBobbin");
|
||||
collectorDispenser = engine.hardwareMap.servo.get("collectorDispenser");
|
||||
|
||||
collectorArmBobbin.setDirection(DcMotorSimple.Direction.FORWARD);
|
||||
}
|
||||
|
||||
private void initDepositor(){
|
||||
depositorDispenser = engine.hardwareMap.servo.get("depositorDispenser");
|
||||
depositorArmBobbin = engine.hardwareMap.dcMotor.get("depositorArmBobbin");
|
||||
depositorArmBobbin.setDirection(DcMotorSimple.Direction.REVERSE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package org.timecrafters.FreightFrenzy.Competition.TeleOp.Engines;
|
||||
|
||||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||
|
||||
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||
import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||
import org.timecrafters.FreightFrenzy.Competition.TeleOp.States.TeleOpState;
|
||||
|
||||
@TeleOp(name = "TeleOp")
|
||||
public class TeleOpEngine extends CyberarmEngine {
|
||||
@Override
|
||||
public void setup() {
|
||||
|
||||
@@ -5,11 +5,14 @@ import org.timecrafters.FreightFrenzy.Competition.Common.Robot;
|
||||
|
||||
public class TeleOpState extends CyberarmState {
|
||||
Robot robot;
|
||||
double maxDriveSpeed;
|
||||
double maxDriveSpeed, maxCollectorArmSpeed, maxDepositorArmSpeed;
|
||||
|
||||
|
||||
public TeleOpState(Robot robot) {
|
||||
this.robot = robot;
|
||||
maxDriveSpeed = 0.7;
|
||||
maxDriveSpeed = 1;
|
||||
maxCollectorArmSpeed = 0.7;
|
||||
maxDepositorArmSpeed = 0.7;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -20,8 +23,9 @@ public class TeleOpState extends CyberarmState {
|
||||
@Override
|
||||
public void exec() {
|
||||
robot.driveWarehouseLeft.setPower(-engine.gamepad1.left_stick_y * maxDriveSpeed);
|
||||
robot.driveWarehouseRight.setPower(-engine.gamepad1.right_stick_y * maxDriveSpeed);
|
||||
robot.driveGoalLeft.setPower(-engine.gamepad1.left_stick_y * maxDriveSpeed);
|
||||
|
||||
robot.driveWarehouseRight.setPower(-engine.gamepad1.right_stick_y * maxDriveSpeed);
|
||||
robot.driveGoalRight.setPower(-engine.gamepad1.right_stick_y * maxDriveSpeed);
|
||||
|
||||
if (engine.gamepad1.left_bumper){
|
||||
@@ -35,6 +39,24 @@ public class TeleOpState extends CyberarmState {
|
||||
} else {
|
||||
robot.collectorDispenser.setPosition(0);
|
||||
}
|
||||
|
||||
robot.collectorArmBobbin.setPower(engine.gamepad1.right_trigger * maxCollectorArmSpeed);
|
||||
|
||||
if (engine.gamepad1.right_trigger <= 0){
|
||||
robot.collectorArmBobbin.setPower(-engine.gamepad1.left_trigger * maxCollectorArmSpeed);
|
||||
}
|
||||
|
||||
|
||||
// GamePad 2
|
||||
robot.depositorArmBobbin.setPower(engine.gamepad2.right_trigger * maxDepositorArmSpeed);
|
||||
|
||||
if (engine.gamepad2.right_trigger <= 0) {
|
||||
robot.depositorArmBobbin.setPower(-engine.gamepad2.left_trigger * maxDepositorArmSpeed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ public class DriveTrainTestState extends CyberarmState {
|
||||
//This one is set up to repeat every few milliseconds
|
||||
@Override
|
||||
public void exec() {
|
||||
|
||||
robot.driveFrontRight.setPower(-engine.gamepad1.right_stick_y * maxSpeed);
|
||||
robot.driveBackRight.setPower(-engine.gamepad1.right_stick_y * maxSpeed);
|
||||
robot.driveFrontLeft.setPower(-engine.gamepad1.left_stick_y * maxSpeed);
|
||||
robot.driveBackLeft.setPower(-engine.gamepad1.left_stick_y * maxSpeed);
|
||||
//
|
||||
// robot.driveFrontRight.setPower(-engine.gamepad1.right_stick_y * maxSpeed);
|
||||
// robot.driveBackRight.setPower(-engine.gamepad1.right_stick_y * maxSpeed);
|
||||
// robot.driveFrontLeft.setPower(-engine.gamepad1.left_stick_y * maxSpeed);
|
||||
// robot.driveBackLeft.setPower(-engine.gamepad1.left_stick_y * maxSpeed);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import org.timecrafters.UltimateGoal.Competition.Autonomous.DriveToCoordinates;
|
||||
import org.timecrafters.UltimateGoal.Competition.Autonomous.Face;
|
||||
import org.timecrafters.UltimateGoal.Competition.Robot;
|
||||
@Disabled
|
||||
@TeleOp (name = "TeleOp",group = "comp")
|
||||
//@TeleOp (name = "TeleOp",group = "comp")
|
||||
public class TeleOpEngine extends CyberarmEngine {
|
||||
|
||||
private Robot robot;
|
||||
|
||||
Reference in New Issue
Block a user