Added Hood with joy, full manual all programmed but not might not work

This commit is contained in:
ryan123rudder
2020-03-11 20:56:18 -06:00
parent b55974b01c
commit db128a328a
6 changed files with 181 additions and 16 deletions
@@ -0,0 +1,53 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc4388.utility.controller;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj2.command.button.Button;
import frc4388.robot.RobotContainer;
import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
/**
* A {@link Button} that gets its state from a {@link GenericHID}.
*/
public class JoystickManualButton extends Button {
private final GenericHID m_joystick;
private final int m_buttonNumber;
private boolean m_buttonType;
/**
* Creates a joystick button for triggering commands.
*
* @param joystick The GenericHID object that has the button (e.g. Joystick,
* KinectStick, etc)
* @param buttonNumber The button number (see
* {@link GenericHID#getRawButton(int) }
*/
public JoystickManualButton(GenericHID joystick, int buttonNumber, boolean buttonType) {
requireNonNullParam(joystick, "joystick", "JoystickButton");
m_joystick = joystick;
m_buttonNumber = buttonNumber;
}
/**
* Gets the value of the joystick button.
*
* @return The value of the joystick button
*/
@Override
public boolean get() {
boolean m = RobotContainer.m_isShooterManual;
if (m_buttonType == m) {
return m_joystick.getRawButton(m_buttonNumber);
} else {
return false;
}
}
}