Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public void execute() {

// The math & signs looks wonky, because this makes things field-relative
// (Remember that "3 O'Clock" is zero degrees)
double yvalue = -y.getAsDouble();
double xvalue = -x.getAsDouble();
double yvalue = y.getAsDouble();
double xvalue = x.getAsDouble();
if (driveStraighten != null) {
if (driveStraighten.getAsDouble() > 0.7) {
if (Math.abs(yvalue) > Math.abs(xvalue)) xvalue = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.firstinspires.ftc.ptechnodactyl.commands;

import com.qualcomm.robotcore.util.ElapsedTime;
import com.technototes.library.command.Command;
import com.technototes.library.control.Stick;
import com.technototes.library.logger.Loggable;
Expand All @@ -10,6 +11,11 @@ public class JoystickIncDecCmd implements Command, Loggable {

public ClawSubsystem subsystem;
public DoubleSupplier x;
public static ElapsedTime timer;

public static double time;

public double interval = 1.5;

public JoystickIncDecCmd(ClawSubsystem sub, Stick xStick) {
addRequirements(sub);
Expand All @@ -23,7 +29,10 @@ public JoystickIncDecCmd(ClawSubsystem sub, Stick xStick) {
@Override
public void execute() {
double xvalue = -x.getAsDouble();
// time = timer.time();
// if (interval < time)
subsystem.increment(xvalue);
// timer.reset();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class DriverController {
public Stick driveLeftStick, driveRightStick;
public CommandButton resetGyroButton, turboButton, snailButton;
public CommandButton override;
public CommandAxis driveStraighten;
public CommandAxis drive45;

public DriverController(CommandGamepad g, Robot r) {
this.robot = r;
Expand All @@ -36,21 +34,13 @@ private void AssignNamedControllerButton() {
resetGyroButton = gamepad.ps_options;
driveLeftStick = gamepad.leftStick;
driveRightStick = gamepad.rightStick;
driveStraighten = gamepad.rightTrigger;
drive45 = gamepad.leftTrigger;
turboButton = gamepad.leftBumper;
snailButton = gamepad.rightBumper;
}

public void bindDriveControls() {
CommandScheduler.scheduleJoystick(
new JoystickDriveCommand(
robot.drivebaseSubsystem,
driveLeftStick,
driveRightStick,
driveStraighten,
drive45
)
new JoystickDriveCommand(robot.drivebaseSubsystem, driveLeftStick, driveRightStick)
);

turboButton.whenPressed(DrivingCommands.TurboDriving(robot.drivebaseSubsystem));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package org.firstinspires.ftc.ptechnodactyl.controllers;

import android.support.v4.app.INotificationSideChannel;
import com.technototes.library.command.CommandScheduler;
import com.technototes.library.control.CommandAxis;
import com.technototes.library.control.CommandButton;
import com.technototes.library.control.CommandGamepad;
import com.technototes.library.control.Stick;
import org.firstinspires.ftc.ptechnodactyl.Robot;
import org.firstinspires.ftc.ptechnodactyl.Setup;
import org.firstinspires.ftc.ptechnodactyl.commands.DrivingCommands;
import org.firstinspires.ftc.ptechnodactyl.commands.JoystickDriveCommand;

public class OneController {

public Robot robot;
public CommandGamepad gamepad;
public CommandButton openClaw;
public CommandButton closeClaw;
public CommandButton ArmHorizontal;
public CommandButton ArmVertical;
public Stick driveLeftStick, driveRightStick;
public CommandButton resetGyroButton, turboButton, snailButton;
public CommandButton increment;
public CommandButton decrement;

public OneController(CommandGamepad g, Robot r) {
robot = r;
gamepad = g;
AssignNamedControllerButton();
BindControls();
}

private void AssignNamedControllerButton() {
openClaw = gamepad.leftBumper;
closeClaw = gamepad.rightBumper;
ArmHorizontal = gamepad.ps_square;
ArmVertical = gamepad.ps_triangle;
increment = gamepad.ps_circle;
decrement = gamepad.ps_cross;
resetGyroButton = gamepad.ps_options;
driveLeftStick = gamepad.leftStick;
driveRightStick = gamepad.rightStick;
turboButton = gamepad.leftBumper;
snailButton = gamepad.rightBumper;
}

public void BindControls() {
if (Setup.Connected.CLAWSUBSYSTEM) {
bindClawSubsystemControls();
}
if (Setup.Connected.DRIVEBASE) {
bindDriveControls();
}
}

public void bindClawSubsystemControls() {
openClaw.whenPressed(robot.clawSubsystem::openClaw);
closeClaw.whenPressed(robot.clawSubsystem::closeClaw);
ArmVertical.whenPressed(robot.clawSubsystem::setArmVertical);
ArmHorizontal.whenPressed(robot.clawSubsystem::setArmHorizontal);
increment.whenPressed(robot.clawSubsystem::incrementn);
decrement.whenPressed(robot.clawSubsystem::decrement);
}

public void bindDriveControls() {
CommandScheduler.scheduleJoystick(
new JoystickDriveCommand(robot.drivebaseSubsystem, driveLeftStick, driveRightStick)
);

turboButton.whenPressed(DrivingCommands.TurboDriving(robot.drivebaseSubsystem));
turboButton.whenReleased(DrivingCommands.NormalDriving(robot.drivebaseSubsystem));
snailButton.whenPressed(DrivingCommands.SnailDriving(robot.drivebaseSubsystem));
snailButton.whenReleased(DrivingCommands.NormalDriving(robot.drivebaseSubsystem));
resetGyroButton.whenPressed(DrivingCommands.ResetGyro(robot.drivebaseSubsystem));
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package org.firstinspires.ftc.ptechnodactyl.controllers;

import com.technototes.library.command.Command;
import com.technototes.library.command.CommandScheduler;
import com.technototes.library.control.CommandButton;
import com.technototes.library.control.CommandGamepad;
import com.technototes.library.control.Stick;
import org.firstinspires.ftc.ptechnodactyl.Robot;
import org.firstinspires.ftc.ptechnodactyl.Setup;
import org.firstinspires.ftc.ptechnodactyl.commands.ClawCmds;
import org.firstinspires.ftc.ptechnodactyl.commands.JoystickIncDecCmd;
import org.firstinspires.ftc.ptechnodactyl.subsystems.ClawSubsystem;

public class OperatorController {

Expand All @@ -18,6 +15,9 @@ public class OperatorController {
public CommandButton openClaw;
public CommandButton closeClaw;
public Stick armStick;
public CommandButton ArmHorizontal;
public CommandButton ArmVertical;
public CommandButton intake;

public OperatorController(CommandGamepad g, Robot r) {
robot = r;
Expand All @@ -30,6 +30,9 @@ private void AssignNamedControllerButton() {
openClaw = gamepad.leftBumper;
closeClaw = gamepad.rightBumper;
armStick = gamepad.rightStick;
ArmHorizontal = gamepad.ps_circle;
ArmVertical = gamepad.ps_triangle;
intake = gamepad.dpadRight;
}

public void BindControls() {
Expand All @@ -39,8 +42,11 @@ public void BindControls() {
}

public void bindClawSubsystemControls() {
openClaw.whenPressed(ClawCmds.cmds.OpenClaw(robot.clawSubsystem));
closeClaw.whenPressed(ClawCmds.cmds.CloseClaw(robot.clawSubsystem));
openClaw.whenPressed(robot.clawSubsystem::openClaw);
closeClaw.whenPressed(robot.clawSubsystem::closeClaw);
ArmVertical.whenPressed(robot.clawSubsystem::setArmVertical);
ArmHorizontal.whenPressed(robot.clawSubsystem::setArmHorizontal);
intake.whenPressed(robot.clawSubsystem::setArmIntake);
CommandScheduler.scheduleJoystick(new JoystickIncDecCmd(robot.clawSubsystem, armStick));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.firstinspires.ftc.ptechnodactyl.controllers;

import com.technototes.library.command.CommandScheduler;
import com.technototes.library.control.CommandButton;
import com.technototes.library.control.CommandGamepad;
import com.technototes.library.control.Stick;
import org.firstinspires.ftc.ptechnodactyl.Robot;
import org.firstinspires.ftc.ptechnodactyl.commands.JoystickIncDecCmd;

public class TestController {

public Robot robot;
public CommandGamepad gamepad;
public CommandButton testPower2;
public CommandButton testPower;
public CommandButton armHorizontal;
public Stick armStick;

public TestController(CommandGamepad g, Robot r) {
robot = r;
gamepad = g;
AssignNamedControllerButton();
BindControls();
}

private void AssignNamedControllerButton() {
testPower = gamepad.leftBumper;
testPower2 = gamepad.rightBumper;
armStick = gamepad.rightStick;
armHorizontal = gamepad.ps_circle;
}

public void BindControls() {
bindTestControls();
}

public void bindTestControls() {
testPower.whenPressed(robot.clawSubsystem::powIncrement);
testPower2.whenPressed(robot.clawSubsystem::powDecrement);
CommandScheduler.scheduleJoystick(new JoystickIncDecCmd(robot.clawSubsystem, armStick));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
import org.firstinspires.ftc.ptechnodactyl.Robot;
import org.firstinspires.ftc.ptechnodactyl.Setup;
import org.firstinspires.ftc.ptechnodactyl.commands.EZCmd;
import org.firstinspires.ftc.ptechnodactyl.commands.JoystickIncDecCmd;
import org.firstinspires.ftc.ptechnodactyl.controllers.DriverController;
import org.firstinspires.ftc.ptechnodactyl.controllers.OperatorController;
import org.firstinspires.ftc.ptechnodactyl.helpers.StartingPosition;

@TeleOp(name = "Driving w/Turbo!")
@TeleOp(name = "PT Driving w/Turbo!")
@SuppressWarnings("unused")
public class JustDrivingTeleOp extends CommandOpMode implements Loggable {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.firstinspires.ftc.ptechnodactyl.opmodes.tele;

import com.acmerobotics.dashboard.FtcDashboard;
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.technototes.library.logger.Loggable;
import com.technototes.library.structure.CommandOpMode;
import org.firstinspires.ftc.ptechnodactyl.Hardware;
import org.firstinspires.ftc.ptechnodactyl.Robot;
import org.firstinspires.ftc.ptechnodactyl.controllers.DriverController;
import org.firstinspires.ftc.ptechnodactyl.controllers.TestController;

@TeleOp(name = "MotorTest")
@SuppressWarnings("unused")
public class MotorTest extends CommandOpMode implements Loggable {

public Hardware hardware;
public Robot robot;

public TestController test;

@Override
public void uponInit() {
telemetry = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
hardware = new Hardware(hardwareMap);
robot = new Robot(hardware);
test = new TestController(driverGamepad, robot);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.firstinspires.ftc.ptechnodactyl.opmodes.tele;

import com.acmerobotics.dashboard.FtcDashboard;
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.technototes.library.command.CommandScheduler;
import com.technototes.library.logger.Loggable;
import com.technototes.library.structure.CommandOpMode;
import org.firstinspires.ftc.ptechnodactyl.Hardware;
import org.firstinspires.ftc.ptechnodactyl.Robot;
import org.firstinspires.ftc.ptechnodactyl.commands.EZCmd;
import org.firstinspires.ftc.ptechnodactyl.controllers.OneController;

@TeleOp(name = "OneController")
@SuppressWarnings("unused")
public class oneController extends CommandOpMode implements Loggable {

public Hardware hardware;
public Robot robot;

public OneController driver;

@Override
public void uponInit() {
telemetry = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
hardware = new Hardware(hardwareMap);
robot = new Robot(hardware);
driver = new OneController(driverGamepad, robot);
CommandScheduler.register(robot.clawSubsystem);
}
}
Loading