From 2e974dab100c6189e06580e218a332337cb1865b Mon Sep 17 00:00:00 2001 From: Brian Semrau Date: Thu, 22 Feb 2018 17:12:09 -0500 Subject: [PATCH] Updated logitech controller to F310 --- ...{LogitechGamepad.java => F310Gamepad.java} | 64 ++++++++++--------- src/org/usfirst/frc/team4737/robot/OI.java | 6 +- 2 files changed, 37 insertions(+), 33 deletions(-) rename src/org/usfirst/frc/team4737/lib/{LogitechGamepad.java => F310Gamepad.java} (52%) diff --git a/src/org/usfirst/frc/team4737/lib/LogitechGamepad.java b/src/org/usfirst/frc/team4737/lib/F310Gamepad.java similarity index 52% rename from src/org/usfirst/frc/team4737/lib/LogitechGamepad.java rename to src/org/usfirst/frc/team4737/lib/F310Gamepad.java index 335001a..523fca4 100644 --- a/src/org/usfirst/frc/team4737/lib/LogitechGamepad.java +++ b/src/org/usfirst/frc/team4737/lib/F310Gamepad.java @@ -1,29 +1,29 @@ package org.usfirst.frc.team4737.lib; -public class LogitechGamepad extends Gamepad { - - private class LogitechGamepadTriggerAxis extends GamepadAxis { - - private final boolean positive; - - public LogitechGamepadTriggerAxis(Gamepad gamepad, String name, int axis, boolean positive) { - super(gamepad, name, axis); - - this.positive = positive; - } - - @Override - public double get() { - double value = super.get(); - if (value > 0 && positive) - return value; - else if (value < 0 && !positive) - return -value; - else - return 0; - } - - } +public class F310Gamepad extends Gamepad { + +// private class LogitechGamepadTriggerAxis extends GamepadAxis { +// +// private final boolean positive; +// +// public LogitechGamepadTriggerAxis(Gamepad gamepad, String name, int axis, boolean positive) { +// super(gamepad, name, axis); +// +// this.positive = positive; +// } +// +// @Override +// public double get() { +// double value = super.get(); +// if (value > 0 && positive) +// return value; +// else if (value < 0 && !positive) +// return -value; +// else +// return 0; +// } +// +// } public final GamepadButton A; public final GamepadButton B; @@ -39,12 +39,14 @@ else if (value < 0 && !positive) public final Thumbstick LS; public final Thumbstick RS; - public final LogitechGamepadTriggerAxis LT; - public final LogitechGamepadTriggerAxis RT; +// public final LogitechGamepadTriggerAxis LT; +// public final LogitechGamepadTriggerAxis RT; + public final GamepadAxis LT; + public final GamepadAxis RT; public final DPad DPAD; - public LogitechGamepad(int usbPort) { + public F310Gamepad(int usbPort) { super(usbPort, "LogitechGamepad"); A = new GamepadButton(this, "A", 1); B = new GamepadButton(this, "B", 2); @@ -60,11 +62,13 @@ public LogitechGamepad(int usbPort) { R3 = new GamepadButton(this, "R3", 10); registerButton(R3, "RS"); - LS = new Thumbstick(this, "LS", 1, 2); + LS = new Thumbstick(this, "LS", 0, 1); RS = new Thumbstick(this, "RS", 4, 5); - LT = new LogitechGamepadTriggerAxis(this, "LT", 3, true); - RT = new LogitechGamepadTriggerAxis(this, "RT", 3, false); +// LT = new LogitechGamepadTriggerAxis(this, "LT", 2, true); +// RT = new LogitechGamepadTriggerAxis(this, "RT", 3, false); + LT = new GamepadAxis(this, "LT", 2); + RT = new GamepadAxis(this, "RT", 3); DPAD = new DPad(this, "DPAD", 0); } diff --git a/src/org/usfirst/frc/team4737/robot/OI.java b/src/org/usfirst/frc/team4737/robot/OI.java index 224628c..f50fa1f 100644 --- a/src/org/usfirst/frc/team4737/robot/OI.java +++ b/src/org/usfirst/frc/team4737/robot/OI.java @@ -8,7 +8,7 @@ package org.usfirst.frc.team4737.robot; import org.usfirst.frc.team4737.lib.Gamepad; -import org.usfirst.frc.team4737.lib.LogitechGamepad; +import org.usfirst.frc.team4737.lib.F310Gamepad; import org.usfirst.frc.team4737.robot.commands.ControlElevator; import org.usfirst.frc.team4737.robot.commands.ControlIntake; import org.usfirst.frc.team4737.robot.commands.ReverseIntake; @@ -54,8 +54,8 @@ public class OI { public Gamepad operator; public OI() { - driver = new LogitechGamepad(0); - operator = new LogitechGamepad(1); + driver = new F310Gamepad(0); + operator = new F310Gamepad(1); // User override to take control of the intake new Trigger() {