mirror of
https://github.com/Team4388/2023WayOfTheRobot.git
synced 2026-06-09 00:37:59 -06:00
fixed with annoying closure solution.
Ask Aarav if there is a better solution
This commit is contained in:
@@ -7,13 +7,11 @@
|
||||
|
||||
package frc4388.robot;
|
||||
|
||||
import com.ctre.phoenix.motorcontrol.InvertType;
|
||||
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX;
|
||||
import com.ctre.phoenix.sensors.PigeonIMU;
|
||||
import com.ctre.phoenix.sensors.CANCoder;
|
||||
import com.ctre.phoenix.sensors.WPI_Pigeon2;
|
||||
|
||||
import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
import frc4388.robot.Constants.LEDConstants;
|
||||
import frc4388.utility.RobotGyro;
|
||||
|
||||
@@ -22,19 +20,19 @@ import frc4388.utility.RobotGyro;
|
||||
* testing and modularization.
|
||||
*/
|
||||
public class RobotMap {
|
||||
public RobotMap() {
|
||||
configureLEDMotorControllers();
|
||||
configureDriveMotors();
|
||||
}
|
||||
|
||||
public RobotMap() {
|
||||
configureLEDMotorControllers();
|
||||
configureDriveMotorControllers();
|
||||
}
|
||||
/* LED Subsystem */
|
||||
public final Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
||||
|
||||
/* LED Subsystem */
|
||||
public final Spark LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
||||
|
||||
void configureLEDMotorControllers() {
|
||||
void configureLEDMotorControllers() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void configureDriveMotorControllers() {
|
||||
}
|
||||
void configureDriveMotors() {
|
||||
// config factory default
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package frc4388.utility.controller;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.button.Button;
|
||||
import edu.wpi.first.wpilibj2.command.button.Trigger;
|
||||
import frc4388.utility.controller.XboxController;
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ import frc4388.utility.controller.XboxController;
|
||||
* buttons in {@link frc4388.robot.OI}. Checks to see if the given trigger
|
||||
* exceeds a tolerance defined in {@link XboxController}.
|
||||
*/
|
||||
public class XboxTriggerButton extends Button {
|
||||
public class XboxTriggerButton extends Trigger {
|
||||
public static final int RIGHT_TRIGGER = 0;
|
||||
public static final int LEFT_TRIGGER = 1;
|
||||
public static final int RIGHT_AXIS_UP_TRIGGER = 2;
|
||||
@@ -20,49 +21,48 @@ public class XboxTriggerButton extends Button {
|
||||
public static final int LEFT_AXIS_RIGHT_TRIGGER = 8;
|
||||
public static final int LEFT_AXIS_LEFT_TRIGGER = 9;
|
||||
|
||||
private XboxController m_controller;
|
||||
private int m_trigger;
|
||||
// private XboxController m_controller;
|
||||
// private int m_trigger;
|
||||
|
||||
/**
|
||||
* Creates a Trigger-Button mapped to a specific Xbox controller and trigger
|
||||
*/
|
||||
public XboxTriggerButton(XboxController controller, int trigger) {
|
||||
m_controller = controller;
|
||||
m_trigger = trigger;
|
||||
super(() -> get(trigger, controller));
|
||||
// m_controller = controller;
|
||||
// m_trigger = trigger;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
// @Override
|
||||
public boolean get() {
|
||||
if (m_trigger == RIGHT_TRIGGER) {
|
||||
return m_controller.getRightTrigger();
|
||||
public static boolean get(int trigger, XboxController controller) {
|
||||
if (trigger == RIGHT_TRIGGER) {
|
||||
return controller.getRightTrigger();
|
||||
}
|
||||
else if (m_trigger == LEFT_TRIGGER) {
|
||||
return m_controller.getLeftTrigger();
|
||||
else if (trigger == LEFT_TRIGGER) {
|
||||
return controller.getLeftTrigger();
|
||||
}
|
||||
else if (m_trigger == RIGHT_AXIS_UP_TRIGGER) {
|
||||
return m_controller.getRightAxisUpTrigger();
|
||||
else if (trigger == RIGHT_AXIS_UP_TRIGGER) {
|
||||
return controller.getRightAxisUpTrigger();
|
||||
}
|
||||
else if (m_trigger == RIGHT_AXIS_DOWN_TRIGGER) {
|
||||
return m_controller.getRightAxisDownTrigger();
|
||||
else if (trigger == RIGHT_AXIS_DOWN_TRIGGER) {
|
||||
return controller.getRightAxisDownTrigger();
|
||||
}
|
||||
else if (m_trigger == RIGHT_AXIS_RIGHT_TRIGGER) {
|
||||
return m_controller.getRightAxisRightTrigger();
|
||||
else if (trigger == RIGHT_AXIS_RIGHT_TRIGGER) {
|
||||
return controller.getRightAxisRightTrigger();
|
||||
}
|
||||
else if (m_trigger == RIGHT_AXIS_LEFT_TRIGGER) {
|
||||
return m_controller.getRightAxisLeftTrigger();
|
||||
else if (trigger == RIGHT_AXIS_LEFT_TRIGGER) {
|
||||
return controller.getRightAxisLeftTrigger();
|
||||
}
|
||||
else if (m_trigger == LEFT_AXIS_UP_TRIGGER) {
|
||||
return m_controller.getLeftAxisUpTrigger();
|
||||
else if (trigger == LEFT_AXIS_UP_TRIGGER) {
|
||||
return controller.getLeftAxisUpTrigger();
|
||||
}
|
||||
else if (m_trigger == LEFT_AXIS_DOWN_TRIGGER) {
|
||||
return m_controller.getLeftAxisDownTrigger();
|
||||
else if (trigger == LEFT_AXIS_DOWN_TRIGGER) {
|
||||
return controller.getLeftAxisDownTrigger();
|
||||
}
|
||||
else if (m_trigger == LEFT_AXIS_RIGHT_TRIGGER) {
|
||||
return m_controller.getLeftAxisRightTrigger();
|
||||
else if (trigger == LEFT_AXIS_RIGHT_TRIGGER) {
|
||||
return controller.getLeftAxisRightTrigger();
|
||||
}
|
||||
else if (m_trigger == LEFT_AXIS_LEFT_TRIGGER) {
|
||||
return m_controller.getLeftAxisLeftTrigger();
|
||||
else if (trigger == LEFT_AXIS_LEFT_TRIGGER) {
|
||||
return controller.getLeftAxisLeftTrigger();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user