intake coded
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
package org.firstinspires.ftc.teamcode.constants;
|
||||||
|
|
||||||
|
import com.acmerobotics.dashboard.config.Config;
|
||||||
|
|
||||||
|
@Config
|
||||||
|
public class ServoVars {
|
||||||
|
|
||||||
|
|
||||||
|
//Standard Naming Convention: servoName_VarInSentenceCase
|
||||||
|
|
||||||
|
public static double turret_Range = 355; //In Degrees
|
||||||
|
public static double turret_GearRatio = 0.9974;
|
||||||
|
|
||||||
|
public static double rejecter_Out = 1.0;
|
||||||
|
public static double rejecter_In = 0.0;
|
||||||
|
}
|
||||||
@@ -13,17 +13,17 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class Drivetrain implements Subsystem {
|
public class Drivetrain implements Subsystem {
|
||||||
|
|
||||||
private GamepadEx gamepad;
|
private final GamepadEx gamepad;
|
||||||
|
|
||||||
public MultipleTelemetry TELE;
|
public MultipleTelemetry TELE;
|
||||||
|
|
||||||
private String Mode = "Default";
|
private String Mode = "Default";
|
||||||
|
|
||||||
private DcMotorEx fl;
|
private final DcMotorEx fl;
|
||||||
|
|
||||||
private DcMotorEx fr;
|
private final DcMotorEx fr;
|
||||||
private DcMotorEx bl;
|
private final DcMotorEx bl;
|
||||||
private DcMotorEx br;
|
private final DcMotorEx br;
|
||||||
|
|
||||||
private double defaultSpeed = 0.7;
|
private double defaultSpeed = 0.7;
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,56 @@
|
|||||||
package org.firstinspires.ftc.teamcode.subsystems;
|
package org.firstinspires.ftc.teamcode.subsystems;
|
||||||
|
|
||||||
|
import static org.firstinspires.ftc.teamcode.constants.ServoVars.*;
|
||||||
|
|
||||||
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
|
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
|
||||||
import com.arcrobotics.ftclib.gamepad.GamepadEx;
|
import com.arcrobotics.ftclib.gamepad.GamepadEx;
|
||||||
import com.qualcomm.robotcore.hardware.DcMotorEx;
|
import com.qualcomm.robotcore.hardware.DcMotorEx;
|
||||||
import com.qualcomm.robotcore.hardware.Gamepad;
|
import com.qualcomm.robotcore.hardware.Gamepad;
|
||||||
import com.rowanmcalpin.nextftc.core.Subsystem;
|
import com.qualcomm.robotcore.hardware.Servo;
|
||||||
|
|
||||||
import org.firstinspires.ftc.teamcode.utils.Robot;
|
import org.firstinspires.ftc.teamcode.utils.Robot;
|
||||||
|
|
||||||
public class Intake extends Subsystem {
|
public class Intake implements Subsystem {
|
||||||
|
|
||||||
private GamepadEx gamepad;
|
|
||||||
|
|
||||||
public MultipleTelemetry TELE;
|
public MultipleTelemetry TELE;
|
||||||
|
|
||||||
|
|
||||||
private DcMotorEx intake;
|
private final DcMotorEx intake;
|
||||||
|
|
||||||
|
private final Servo kicker;
|
||||||
|
|
||||||
public Intake (Robot robot, MultipleTelemetry telemetry, GamepadEx gamepad){
|
private double intakePower = 0.0;
|
||||||
|
|
||||||
|
private double kickerPos = 0.0;
|
||||||
|
|
||||||
|
public Intake (Robot robot, MultipleTelemetry telemetry){
|
||||||
|
|
||||||
|
this.intake = robot.intake;
|
||||||
|
this.kicker = robot.rejecter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIntakePower (double pow){
|
||||||
|
this.intakePower = pow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getIntakePower() {
|
||||||
|
return this.intakePower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void kickOut (){
|
||||||
|
this.kickerPos = rejecter_Out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void kickIn (){
|
||||||
|
this.kickerPos = rejecter_In;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
kicker.setPosition(kickerPos);
|
||||||
|
intake.setPower(intakePower);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.firstinspires.ftc.teamcode.subsystems;
|
package org.firstinspires.ftc.teamcode.subsystems;
|
||||||
|
|
||||||
|
import static org.firstinspires.ftc.teamcode.constants.ServoVars.*;
|
||||||
|
|
||||||
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
|
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
|
||||||
import com.acmerobotics.roadrunner.Pose2d;
|
import com.acmerobotics.roadrunner.Pose2d;
|
||||||
import com.arcrobotics.ftclib.controller.PIDController;
|
import com.arcrobotics.ftclib.controller.PIDController;
|
||||||
@@ -210,7 +212,6 @@ public class Shooter implements Subsystem {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//0.9974 * 355
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -224,7 +225,7 @@ public class Shooter implements Subsystem {
|
|||||||
deltaAngle +=360;
|
deltaAngle +=360;
|
||||||
}
|
}
|
||||||
|
|
||||||
deltaAngle /= (0.9974*355);
|
deltaAngle /= (turret_GearRatio*turret_Range);
|
||||||
|
|
||||||
return (0.5+deltaAngle) ;
|
return (0.5+deltaAngle) ;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user