项目:Spartonics-Code
文件:OI.java
public OI() {
driveStick = new Joystick(RobotMap.DRIVE_STICK_NUMBER);
driveButtons = new JoystickButton[13];
auxiliaryStick = new Joystick(RobotMap.AUXILLIARY_STICK_NUMBER);
auxiliaryButtons = new JoystickButton[13];
for(int i = 1; i <= driveButtons.length - 1; i++) {
driveButtons[i] = new JoystickButton(driveStick,i);
}
for(int i=1; i <= auxiliaryButtons.length - 1; i++){
auxiliaryButtons[i] = new JoystickButton(auxiliaryStick,i);
}
//this.getButton(RobotMap.SHOOTER_CONTROL_BUTTON).whileHeld(new ShooterControl());
this.getButton(2).whenpressed(new openIntake());
this.getButton(3).whenpressed(new closeIntake());
this.getButton(4).toggleWhenpressed(new IntakeIn());
this.getButton(5).toggleWhenpressed(new IntakeOut());
this.getButton(5).toggleWhenpressed(new stopIntake());
this.getButton(4).whenpressed(new driveForward(20,.25));
}
项目:FRC-2017-Command
文件:OI.java
public OI(){
JoystickButton x = new JoystickButton(controller,3);
JoystickButton y = new JoystickButton(controller,4);
JoystickButton a = new JoystickButton(controller,1);
JoystickButton b = new JoystickButton(controller,2);
JoystickButton rb = new JoystickButton(controller,6);
JoystickButton lb = new JoystickButton(controller,5);
JoystickButton start = new JoystickButton(controller,8);
JoystickButton back = new JoystickButton(controller,7);
a.whileHeld(new PickupOn());
b.whileHeld(new PickupReverse());
y.whileHeld(new OpenGDS(5));
x.whileHeld(new climb());
rb.whileHeld(new SpinVoltage(0.80,false));
start.toggleWhenpressed(new ResetWinch());
lb.whileHeld(new InvertedStickDrive());
}
项目:SteamWorks
文件:OI.java
public OI() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
logitech = new Joystick(0);
shooterbutton = new JoystickButton(logitech,1);
shooterbutton.whileHeld(new shoot());
// SmartDashboard Buttons
SmartDashboard.putData("Autonomous Command",new AutonomousCommand());
SmartDashboard.putData("shoot",new shoot());
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
shootBackwardsButton = new JoystickButton(logitech,2);
shootBackwardsButton.whileHeld(new ShootReverse());
LiftUPButton = new JoystickButton(logitech,3);
LiftReservseButton = new JoystickButton(logitech,4);
LiftUPButton.whileHeld(new LiftUP());
LiftReservseButton.whileHeld(new LiftReverse());
}
项目:frc-robot
文件:Controller.java
public Controller(int port) {
// Controller
joystick = new Joystick(port);
// Buttons
buttonA = new JoystickButton(joystick,Mappings.BUTTON_A);
buttonB = new JoystickButton(joystick,Mappings.BUTTON_B);
buttonX = new JoystickButton(joystick,Mappings.BUTTON_X);
buttonY = new JoystickButton(joystick,Mappings.BUTTON_Y);
buttonLeftBumper = new JoystickButton(joystick,Mappings.BUTTON_LEFTBUMPER);
buttonRightBumper = new JoystickButton(joystick,Mappings.BUTTON_RIGHTBUMPER);
// Axes
axisLeftX = new JoystickAxis(joystick,Mappings.AXIS_LEFT_X,AXIS_THRESHOLD);
axisLeftY = new JoystickAxis(joystick,Mappings.AXIS_LEFT_Y,AXIS_THRESHOLD);
axisRightX = new JoystickAxis(joystick,Mappings.AXIS_RIGHT_X,AXIS_THRESHOLD);
axisRightY = new JoystickAxis(joystick,Mappings.AXIS_RIGHT_Y,AXIS_THRESHOLD);
axisLeftTrigger = new JoystickAxis(joystick,Mappings.AXIS_LEFT_TRIGGER,AXIS_THRESHOLD);
axisRightTrigger = new JoystickAxis(joystick,Mappings.AXIS_RIGHT_TRIGGER,AXIS_THRESHOLD);
}
项目:El-Jefe-2017
文件:OI.java
public OI(){
joystick = new Joystick(0);
jyButton1 = new JoystickButton(joystick,1);
xBox = new Joystick(1);
xbButton1 = new JoystickButton(xBox,1);
xbButton2 = new JoystickButton(xBox,2);
xbButton3 = new JoystickButton(xBox,3);
xbButton4 = new JoystickButton(xBox,4);
xbButton5 = new JoystickButton(xBox,5);
xbButton6 = new JoystickButton(xBox,6);
jyButton1.whileHeld(new FineControl());
xbButton1.whileHeld(new Shoot());
xbButton2.toggleWhenpressed(new Intaketoggle());
xbButton3.toggleWhenpressed(new ToggleShooter());
xbButton4.whenpressed(new ClawSet());
xbButton5.whenpressed(new gripControl(0));
xbButton6.whenpressed(new gripControl(1));
}
/**
* @param port of the controller.
*/
public XBoxController(int port) {
super(port);
a = new JoystickButton(this,1);
b = new JoystickButton(this,2);
x = new JoystickButton(this,3);
y = new JoystickButton(this,4);
leftBumper = new JoystickButton(this,5);
rightBumper = new JoystickButton(this,6);
select = new JoystickButton(this,7);
start = new JoystickButton(this,8);
leftJoystickButton = new JoystickButton(this,9);
rightJoystickButton = new JoystickButton(this,10);
leftTrigger = new AnalogButton(this,2,0.1);
rightTrigger = new AnalogButton(this,3,0.1);
}
public XBoxController(final int port) {
super(port); // Extends Joystick...
/* Initialize */
this.port = port;
this.controller = new Joystick(this.port); // Joystick referenced by
// everything
this.dPad = new DirectionalPad(this.controller);
this.lt = new Trigger(this.controller,HAND.LEFT);
this.rt = new Trigger(this.controller,HAND.RIGHT);
this.a = new JoystickButton(this.controller,A_BUTTON_ID);
this.b = new JoystickButton(this.controller,B_BUTTON_ID);
this.x = new JoystickButton(this.controller,X_BUTTON_ID);
this.y = new JoystickButton(this.controller,Y_BUTTON_ID);
this.lb = new JoystickButton(this.controller,LB_BUTTON_ID);
this.rb = new JoystickButton(this.controller,RB_BUTTON_ID);
this.back = new JoystickButton(this.controller,BACK_BUTTON_ID);
this.start = new JoystickButton(this.controller,START_BUTTON_ID);
this.rightClick = new JoystickButton(this.controller,RIGHT_CLICK_ID);
this.leftClick = new JoystickButton(this.controller,LEFT_CLICK_ID);
}
项目:Stronghold-2016
文件:OI.java
public void initButtons() {
//intakeButtonIn = new JoystickButton(secondary,RobotMap.INTAKE_BUTTON_IN);
//intakeButtonOut = new JoystickButton(secondary,RobotMap.INTAKE_BUTTON_OUT);
//shooterButtonIn = new JoystickButton(secondary,RobotMap.SHOOTER_BUTTON_IN);
//shooterButtonOut = new JoystickButton(secondary,RobotMap.SHOOTER_BUTTON_OUT);
//autoIntakeButton = new JoystickButton(secondary,RobotMap.AUTO_INTAKE_BUTTON);
//pusherButton = new JoystickButton(secondary,RobotMap.PUSHER_BUTTON);
//driveIntakeOut = new JoystickButton(secondary,RobotMap.INTAKE_BUTTON_OUT);
//lockButton = new JoystickButton(secondary,RobotMap.LOCK_BUTTON);
//autoaimButton = new JoystickButton(secondary,RobotMap.AUTO_aim_BUTTON);
//autoShootButton = new JoystickButton(secondary,RobotMap.AUTO_SHOOT_BUTTON);
//autoIntakeButton = new JoystickButton(secondary,RobotMap.AUTO_INTAKE_BUTTON);
//autoResetShooterButton = new JoystickButton(secondary,RobotMap.RESET_SHOOTER_BUTTON);
manipulatorUp = new JoystickButton(right,RobotMap.MANIPULATOR_UP_BUTTON);
manipulatorDown = new JoystickButton(right,RobotMap.MANIPULATOR_DOWN_BUTTON);
spinFrontButton = new JoystickButton(right,RobotMap.SPIN_BUTTON_FRONT);
spinBackButton = new JoystickButton(right,RobotMap.SPIN_BUTTON_BACK);
tieButtons();
}
/**
* (Constructor #1)
* There are two ways to make an XBoxController. With this constructor,* you can specify which port you expect the controller to be on.
* @param port
*/
public XBoxController(final int port) {
super(port); // Extends Joystick...
/* Initialize */
this.port = port;
this.controller = new Joystick(this.port); // Joystick referenced by everything
this.leftStick = new Thumbstick (this.controller,HAND.LEFT);
this.rightStick = new Thumbstick (this.controller,HAND.RIGHT);
this.dPad = new DirectionalPad(this.controller);
this.lt = new Trigger (this.controller,HAND.LEFT);
this.rt = new Trigger (this.controller,HAND.RIGHT);
this.a = new JoystickButton(this.controller,A_BUTTON_ID);
this.b = new JoystickButton(this.controller,B_BUTTON_ID);
this.x = new JoystickButton(this.controller,X_BUTTON_ID);
this.y = new JoystickButton(this.controller,Y_BUTTON_ID);
this.lb = new JoystickButton(this.controller,LB_BUTTON_ID);
this.rb = new JoystickButton(this.controller,RB_BUTTON_ID);
this.back = new JoystickButton(this.controller,BACK_BUTTON_ID);
this.start = new JoystickButton(this.controller,START_BUTTON_ID);
}
项目:2015RobotCode
文件:Robot.java
public Robot() { // initialize variables in constructor
stick = new Joystick(RobotMap.JOYSTICK_PORT); // set the stick to refer to joystick #0
button = new JoystickButton(stick,RobotMap.BTN_TRIGGER);
myRobot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR,RobotMap.REAR_LEFT_MOTOR,RobotMap.FRONT_RIGHT_MOTOR,RobotMap.REAR_RIGHT_MOTOR);
myRobot.setExpiration(RobotDrive.kDefaultExpirationTime); // set expiration time for motor movement if error occurs
pdp = new PowerdistributionPanel(); // instantiate class to get PDP values
compressor = new Compressor(); // Compressor is controlled automatically by PCM
solenoid = new DoubleSolenoid(RobotMap.soLENOID_PCM_PORT1,RobotMap.soLENOID_PCM_PORT2); // solenoid on PCM port #0 & #1
/*camera = CameraServer.getInstance();
camera.setQuality(50);
camera.setSize(200);*/
frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB,0); // create the image frame for cam
session = NIVision.IMAQdxOpenCamera("cam0",NIVision.IMAQdxcameraControlMode.CameraControlModeController); // get reference to camera
NIVision.IMAQdxconfigureGrab(session); // grab current streaming session
}
项目:Swerve
文件:OI.java
public OI() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driverStick = new Joystick(1);
coStick = new Joystick(2);
autoSteerButton = new JoystickButton(driverStick,2);
shootButton = new JoystickButton(coStick,1);
eightBallSpit = new JoystickButton(coStick,2);
eightBallSuck = new JoystickButton(coStick,3);
bunnyLaunchButton = new JoystickButton(coStick,4);
shootButton.whileHeld(new ShootCommand());
eightBallSuck.whileHeld(new EightBallSuck());
eightBallSpit.whileHeld(new EightBallSpit());
bunnyLaunchButton.whileHeld(new BunnyLaunch());
// SmartDashboard Buttons
//SmartDashboard.putData("Autonomous Command",new AutonomousCommand());
//SmartDashboard.putData("DriveLoop",new DriveLoop());
SmartDashboard.putData("Reset Gyro",new ResetGyroCommand(Math.PI));
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
项目:Veer
文件:OI.java
public OI() {
joystick1 = new Joystick(RobotMap.J1);
joystick2 = new Joystick(RobotMap.J2);
Snake = new JoystickButton(joystick1,ButtonType.LeftThumb);
Snake.whileHeld(new Subsystem.Swerve.C_Snake());
GoToheading = new JoystickButton(joystick1,ButtonType.RightThumb);
GoToheading.whileHeld(new Subsystem.Swerve.C_GoToheading());
Pivot0 = new JoystickButton(joystick1,ButtonType.L1);
Pivot0.whileHeld(new Subsystem.Swerve.C_Pivot());
Pivot1 = new JoystickButton(joystick1,ButtonType.R1);
Pivot1.whileHeld(new Subsystem.Swerve.C_Pivot());
Pivot2 = new Bumper(joystick1,Axis.Trigger);
Pivot2.whileHeld(new Subsystem.Swerve.C_Pivot());
ZeroModules = new JoystickButton(joystick1,ButtonType.A);
ZeroModules.whenpressed(new Subsystem.Swerve.C_ZeroModules());
ResetGyro = new JoystickButton(joystick1,ButtonType.B);
ResetGyro.whenpressed(new Subsystem.Swerve.C_ResetGyro());
CancelZeroModules = new JoystickButton(joystick1,ButtonType.X);
}
项目:NR-2014-CMD
文件:OI.java
public static void init()
{
stick1 = new Joystick(1);
stick2 = new Joystick(2);
new JoystickButton(stick1,5).whenpressed(new ShiftCommand(true));
new JoystickButton(stick1,3).whenpressed(new ShiftCommand(false));
new JoystickButton(stick2,7).whenpressed(new StopBallIntakeCommand());
new JoystickButton(stick2,6).whenpressed(new BallIntakeCommand());
new JoystickButton(stick2,11).whileHeld(new ShooterRotationCommand(-Shooterrotator.REGULAR_SPEED));
new JoystickButton(stick2,10).whileHeld(new ShooterRotationCommand(Shooterrotator.REGULAR_SPEED));
new JoystickButton(stick2,2).whenpressed(new ShooterRotateTargetCommand(Shooterrotator.AUTONOMOUS_ANGLE));
new JoystickButton(stick2,1).whenpressed(new PunchGroupCommand());
new JoystickButton(stick2,9).whenpressed(new TopArmDownCommand());
new JoystickButton(stick2,8).whenpressed(new TopArmUpCommand());
new JoystickButton(stick2,11).whenpressed(new ResetDogEarCommand());
new JoystickButton(stick2,3).whenpressed(new AutonomousCommand());
}
public static void init() {
// Spin Up
shootButton = new JoystickButton[1];
shootButton[0] = new JoystickButton(stick,LEFT_BUMPER_BUTTON); // Left bumper
shootButton[0].whileHeld(new SpeedUpShooter());
// Shoot
shootFrisbee = new JoystickButton[1];
shootFrisbee[0] = new JoystickButton(stick,RIGHT_BUMPER_BUTTON); // Right bumper
shootFrisbee[0].whenpressed(new PushFrisbeeOut());
startCompressor = new JoystickButton[2];
startCompressor[0] = new JoystickButton(stick,A_BUTTON); // A button
startCompressor[0].whileHeld(new StartCompressor());
}
项目:Command-Based-Robot
文件:OI.java
private void initButtons() {
// Wills buttons
driveMode = new JoystickButton(driveStick,1);
wAngle = new JoystickButton(driveStick,4);
wLength = new JoystickButton(driveStick,5);
//Right Buttons
rAngle = new JoystickButton(rightStick,1);
rLength = new JoystickButton(rightStick,2);
rLock = new JoystickButton(rightStick,4);
rULock = new JoystickButton(rightStick,5);
rAdjust = new JoystickButton(rightStick,8);
//Left Buttons
lAngle = new JoystickButton(leftStick,1);
lLength = new JoystickButton(leftStick,2);
lLock = new JoystickButton(leftStick,4);
lULock = new JoystickButton(leftStick,5);
lAdjust = new JoystickButton(leftStick,8);
//Assign the buttons to their commands
tieButtons();
}
项目:Zed-Java
文件:Gamepad.java
public Gamepad(int port) {
joystick = new Joystick(port);
LEFT_BUMPER = new JoystickButton(joystick,5);
LEFT_TRIGGER = new JoystickButton(joystick,7);
RIGHT_BUMPER = new JoystickButton(joystick,6);
RIGHT_TRIGGER = new JoystickButton(joystick,8);
DIAMOND_LEFT = new JoystickButton(joystick,1);
DIAMOND_DOWN = new JoystickButton(joystick,2);
DIAMOND_RIGHT = new JoystickButton(joystick,3);
DIAMOND_UP = new JoystickButton(joystick,4);
MIDDLE_LEFT = new JoystickButton(joystick,9);
MIDDLE_RIGHT = new JoystickButton(joystick,10);
LEFT_JOYSTICK_BUTTON = new JoystickButton(joystick,11);
RIGHT_JOYSTICK_BUTTON = new JoystickButton(joystick,12);
DPAD_UP = new DPadButton(this,DPadButton.DPAD_UP);
DPAD_DOWN = new DPadButton(this,DPadButton.DPAD_DOWN);
DPAD_LEFT = new DPadButton(this,DPadButton.DPAD_LEFT);
DPAD_RIGHT = new DPadButton(this,DPadButton.DPAD_RIGHT);
}
项目:CK_16_Java
文件:OI.java
public OI()
{
// Init Joystick and Gamepad
driverJoystick = new Joystick(1);
shooterGamepad = new Joystick(2);
// Init Buttons
buttonInvertTiltJoy1 = new JoystickButton(driverJoystick,8); // Tilt shooter on joystick
buttonInvertTiltJoy2 = new JoystickButton(shooterGamepad,5); // Tilt shooter on gamepad
buttonInvertHangPiston = new JoystickButton(driverJoystick,6); // Invert hang position (timeout needed)
buttonExtendFirePiston = new JoystickButton(shooterGamepad,6); // Extend fire piston
buttonToggleShooterWheels = new JoystickButton(shooterGamepad,2); // Toggle wheel spinning
buttonForwardRollers = new JoystickButton(shooterGamepad,3); // Manually run rollers forward
buttonReverseRollers = new JoystickButton(shooterGamepad,7); // Manually run rollers in reverse
buttonManualLoadPiston = new JoystickButton(shooterGamepad,1); // Manually control load piston
buttonToggleAutoLoad = new JoystickButton(shooterGamepad,8); // Toggle AutoLoad
}
项目:Robot-Code-2013
文件:OI.java
public OI() {
leftJoy = new Joystick(RobotMap.LEFT_JOY_PORT);
rightJoy = new Joystick(RobotMap.RIGHT_JOY_PORT);
shootController = new Joystick(RobotMap.SHOOTER_CONTROLLER_PORT);
rightTriggerButton = new JoystickButton(rightJoy,1);
loadButton = new JoystickButton(shootController,9);
shootButton = new JoystickButton(shootController,2);
shootUp = new JoystickButton(shootController,6);
shootDown = new JoystickButton(shootController,5);
overrideButton = new JoystickButton(shootController,8);
LEDButton = new JoystickButton(shootController,7);
rightTriggerButton.whenpressed(new WriteHeight());
loadButton.whenpressed(new Load());
shootUp.whenpressed(new ShootSpeedUp());
shootDown.whenpressed(new ShootSpeedDown());
overrideButton.whenpressed(new OverrideMode());
LEDButton.whenpressed(new LED());
}
项目:Spartonics-Code
文件:OI.java
public JoystickButton getButton(int buttonNum,boolean auxiliary) {
if(auxiliary){
return this.auxiliaryButtons[buttonNum];
}else{
return this.driveButtons[buttonNum];
}
}
项目:Spartonics-Code
文件:OI.java
public OI() {
driveStick = new Joystick(RobotMap.DRIVE_STICK_NUMBER);
driveButtons = new JoystickButton[13];
auxiliaryStick = new Joystick(RobotMap.AUXILIARY_STICK_NUMBER);
auxiliaryButtons = new JoystickButton[13];
for(int i = 1; i <= driveButtons.length - 1; i++) {
driveButtons[i] = new JoystickButton(driveStick,i);
}
//this.getButton(RobotMap.SHOOTER_CONTROL_BUTTON).whileHeld(new ShooterControl());
this.getButton(RobotMap.WINCH_UP_BUTTON).whenpressed(new WinchUp());
this.getButton(RobotMap.WINCH_DOWN_BUTTON).whileHeld(new WinchDown());
this.getButton(RobotMap.INTAKE_FORWARD_BUTTON,true).toggleWhenpressed(new ForwardIntake());
this.getButton(RobotMap.INTAKE_BACKWARD_BUTTON,true).whileHeld(new ReverseIntake());
this.getButton(RobotMap.REVERSE_DRIVE_BUTTON).whenpressed(new FlipChassisDirection());
this.getButton(RobotMap.SHIFT_DOWN_BUTTON,true).whileHeld(new ShiftDown());
this.getButton(RobotMap.SHIFT_UP_BUTTON,true).whileHeld(new ShiftUp());
this.getButton(RobotMap.TURN_ENCODERS_OFF,true).toggleWhenpressed(new RemoveEncoderInfluence());
}
项目:FRC6706_JAVA2017
文件:OI.java
public OI(){
//SmartDashboard.putNumber("Get Ball Speed",Robot.pivot.getAngle());
SmartDashboard.putData("Cast Ball In",new CastInBallCommand());
SmartDashboard.putData("Cast Ball Out",new CastOutBallCommand());
SmartDashboard.putData("Stop Cast Ball",new StopCastBallCommand());
SmartDashboard.putData("Get Ball In",new GetInBallCommand());
SmartDashboard.putData("Stop Get Ball",new StopGetBallCommand());
SmartDashboard.putData("climb Rope Up",new climbropeUpCommand());
SmartDashboard.putData("Stop climb Rope",new climbropeHoldCommand());
//Button Drive
new JoystickButton(mystick,RobotMap.DriveForward).whileHeld(new DriveTrainForwardButtonCommand());
new JoystickButton(mystick,RobotMap.DriveBack).whileHeld(new DriveTrainBackButtonCommand());
new JoystickButton(mystick,RobotMap.DriveLeft).whileHeld(new DriveTrainLeftButtonCommand());
new JoystickButton(mystick,RobotMap.DriveRight).whileHeld(new DriveTrainRightButtonCommand());
new JoystickButton(mystick,RobotMap.TurnLeft).whenpressed(new DriveTrainTurnLeft());//need test
new JoystickButton(mystick,RobotMap.TurnRight).whenpressed(new DriveTrainTurnRight());//need test
// GetBall buttons
new JoystickButton(myRobotStick,RobotMap.GetInBall).whenpressed(new GetInBallCommand());
new JoystickButton(myRobotStick,RobotMap.StopGetBall).whenpressed(new StopGetBallCommand());
// CastBall buttons
new JoystickButton(myRobotStick,RobotMap.CastInBall).whenpressed(new CastInBallCommand());
new JoystickButton(myRobotStick,RobotMap.CastOutBall).whenpressed(new CastOutBallCommand());
new JoystickButton(myRobotStick,RobotMap.StopCastBall).whenpressed(new StopCastBallCommand());
// CastBall buttons
new JoystickButton(myRobotStick,RobotMap.climbropeUpButton).whenpressed(new climbropeUpCommand());
new JoystickButton(myRobotStick,RobotMap.climbropeUpButton2).whenpressed(new climbropeUpCommand2());
new JoystickButton(myRobotStick,RobotMap.climbropeHoldButton).whenpressed(new climbropeHoldCommand());
new JoystickButton(mystick,RobotMap.climbropeUp2).whenpressed(new climbropeUpCommand());
new JoystickButton(mystick,RobotMap.climbropeHold2).whenpressed(new climbropeHoldCommand());
}
项目:MinuteMan
文件:OI.java
/**
* Populates the array "buttons" with buttons from 1 to 12 of each joystick.
* @author vincent Benenati
* @author Robert Smith
*/
private void createButtons(){
for(int joystickNum = 0; joystickNum < JOYSTICK_NUM; joystickNum++){
for(int buttonNum = 0; buttonNum < BUTTON_NUM; buttonNum++){
buttons[joystickNum][buttonNum] = new JoystickButton(joysticks[joystickNum],buttonNum + 1);
}
}
}
项目:MinuteMan
文件:S_DTWhole.java
public void safeArcadeDrive(Joystick joystick,JoystickButton safetyButton,boolean squaredInputs){
if(safetyButton.get()){
robotDrive.arcadeDrive(joystick,squaredInputs);
}
else{
robotDrive.stopMotor();
}
}
项目:MinuteMan
文件:S_DTWhole.java
public void safeTankDrive(Joystick leftJoystick,Joystick rightJoystick,JoystickButton[] safetyButtons,boolean squaredInputs){
if(getAll(safetyButtons)){
robotDrive.tankDrive(leftJoystick,rightJoystick,squaredInputs);
}
else{
robotDrive.stopMotor();
}
}
项目:MinuteMan
文件:S_DTWhole.java
private boolean getAll(JoystickButton[] buttons){
for(int buttonNum = 0; buttonNum < buttons.length; buttonNum++){
if(!buttons[buttonNum].get()){
return false;
}
}
return true;
}
项目:2016Robot
文件:OI.java
public OI() {
inputRecordings = new ArrayList<double[]>();
joystick1 = new Joystick(0);
joystick2 = new Joystick(1);
operator = new Joystick(2);
new JoystickButton(joystick1,1).whenpressed(new ShootIntoGoal());
new JoystickButton(joystick1,3).whenpressed(new SetShooterToTestSpeed());
new JoystickButton(joystick1,5).whileHeld(new TurnToOpponentAlliance());
new JoystickButton(joystick1,6).whenpressed(new DecreaseShooterTestSpeed());
new JoystickButton(joystick1,7).whileHeld(new TurnToOurAlliance());
new JoystickButton(joystick1,8).whenpressed(new IncreaseShooterTestSpeed());
new JoystickButton(operator,1).whenpressed(new ShooterToBottom());
new JoystickButton(operator,2).whenpressed(new ToggleShooterPiston());
new JoystickButton(operator,3).whileHeld(new ManualShooterangle());
// new JoystickButton(operator,4).whenpressed(new ArmsUp());
new JoystickButton(operator,5).whileHeld(new ShooterManualJogUp());
new JoystickButton(operator,6).whileHeld(new ShooterOuttake());
new JoystickButton(operator,7).whenpressed(new ShootFullSpeed());
// new JoystickButton(operator,8).whenpressed(new ArmsDown());
new JoystickButton(operator,9).whileHeld(new ShooterManualJogDown());
new JoystickButton(operator,10).whileHeld(new ShooterIntake());
new JoystickButton(operator,11).whenpressed(new SafeArmsToggle());
new JoystickButton(operator,12).whenpressed(new ShootIntoGoal());
}
项目:Stronghold
文件:OI.java
public OI() {
leftController.setDeadband(0.2);
rightController.setDeadband(0.2);
//Catapult
Button launch = new JoystickButton(leftController,XBoxController.RightBumper);
//Button autoaim = new JoystickButton(driveController,XBoxController.Start);
Button lockLatch = new JoystickButton(leftController,XBoxController.LeftBumper);
Button LaunchGroup = new JoystickButton(leftController,XBoxController.Back);
launch.whenpressed(new Launch());
lockLatch.whenpressed(new LockLatch());
//autoaim.whenpressed(new Autoaim());
LaunchGroup.whenpressed(new LaunchGroup());
//Intake
Button lowerIntake = new JoystickButton(leftController,XBoxController.X);
Button raiseIntake = new JoystickButton(leftController,XBoxController.Y);
Button posCatForLoad = new JoystickButton(leftController,XBoxController.B);
Button posCatForLaunch = new JoystickButton(leftController,XBoxController.A);
lowerIntake.whenpressed(new LowerIntake());
raiseIntake.whenpressed(new RaiseIntake());
posCatForLoad.whenpressed(new PosCatForLoad());
posCatForLaunch.whenpressed(new PosCatForLaunch()) ;
// //Driving
// Button switchDirection = new JoystickButton(driveController,XBoxController.Start);
// switchDirection.whenpressed(new SwitchDirection());
}
项目:Bernie
文件:OI.java
public OI() {
xBoxController = new Joystick(0);
xBoxController2 = new Joystick(1);
xBoxAButton = new JoystickButton(xBoxController,1);
//xBoxAButton.whileHeld(new Parallel());
xBoxAButton.whileHeld(new Shoot());
xBoxBButton = new JoystickButton(xBoxController,2);
//xBoxBButton.whileHeld(new Intaking());
xBoxXButton = new JoystickButton(xBoxController,3);
xBoxYButton = new JoystickButton(xBoxController,4);
xBoxAButton2 = new JoystickButton(xBoxController2,1);
//xBoxAButton2.whileHeld(new PortArmDown());
xBoxRightBumper = new JoystickButton(xBoxController,6);
xBoxRightBumper.whileHeld(new FullForward());
xBoxLeftBumper = new JoystickButton(xBoxController,5);
xBoxLeftBumper.whileHeld(new FullBackward());
xBoxBButton2 = new JoystickButton(xBoxController2,2);
xBoxBButton2.whileHeld(new Wind());
xBoxXButton2 = new JoystickButton(xBoxController2,3);
xBoxXButton2.whileHeld(new Clutch());
xBoxYButton2 = new JoystickButton(xBoxController2,4);
xBoxYButton2.whileHeld(new ClutchOut());
xBoxLeftBumper2 = new JoystickButton(xBoxController2,6);
xBoxLeftBumper2.whileHeld(new Parallel());
xBoxRightBumper2 = new JoystickButton(xBoxController2,5);
xBoxRightBumper2.whileHeld(new Intaking());
xBoxBackButton2 = new JoystickButton(xBoxController2,7);
//xBoxBackButton2.whileHeld(new SwitchCamera());
// SmartDashboard Buttons
//SmartDashboard.putData("Autonomous Command",new AutonomousCommand());
}
项目:FRC-2016
文件:AdvJoystick.java
/**
* @param port of the controller.
*/
public AdvJoystick(int port) {
super(port);
trigger = new JoystickButton(this,1);
thumb = new JoystickButton(this,2);
three = new JoystickButton(this,3);
four = new JoystickButton(this,4);
five = new JoystickButton(this,5);
six = new JoystickButton(this,6);
}
项目:Stronghold_2016
文件:OI.java
public OI() {
leftStick = new Joystick(1);
rightStick = new Joystick(2);
xBoxController = new XBoxController(3);
// Joystick buttons
upShifter = new JoystickButton(rightStick,7);
downShifter = new JoystickButton(leftStick,7);
leftTrigger = new JoystickButton(leftStick,1);
rightTrigger = new JoystickButton(rightStick,1);
//Drive Controls
leftTrigger.whenpressed(new GearShiftCommand(true));
rightTrigger.whenpressed(new GearShiftCommand(false));
//Intake Controls
xBoxController.a.whileHeld(new IntakeRollerCommand("out"));
xBoxController.y.whileHeld(new IntakeRollerCommand("in"));
xBoxController.x.whenReleased(new IntakePistonCommand());
//Shooter Controls
// xBoxController.dPad.up.whenpressed(new ShooterWheelToggleCommand(true));
// xBoxController.dPad.down.whenpressed(new ShooterWheelToggleCommand(false));
xBoxController.rt.whenpressed(new ShooterPistonCommand(false));
xBoxController.lt.whenpressed(new ShooterPistonCommand(true));
xBoxController.b.whileHeld(new ShooterWheelCommand());
if(xBoxController.rb.get()){
Robot.intakeRollerSubsystem.setoverride(true);
}
xBoxController.rb.whenReleased(new DefensePistonCommand(true));
xBoxController.lb.whenReleased(new DefensePistonCommand(false));
}
public OI() {
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
functionJoystick = new Joystick(1);
driverJoystick = new Joystick(0);
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
SmartDashboard.putData("Reset encoder",new ResetEncoder());
SmartDashboard.putData("Reset encoder",new ResetGyro());
Button armsMoveIn = new JoystickButton(functionJoystick,1); // A button
Button armsMoveOut = new JoystickButton(functionJoystick,2); // B button
Button boomUp = new JoystickButton(functionJoystick,3);
Button boomDown = new JoystickButton(functionJoystick,4);
Button rcUp = new JoystickButton(functionJoystick,6);
Button rcDown = new JoystickButton(functionJoystick,5);
armsMoveIn.whileHeld(new ArmCommand(true));
armsMoveOut.whileHeld(new ArmCommand(false));
boomUp.whileHeld(new ElevatorCommand(true,false));
boomUp.whenReleased(new ElevatorCommand(true,true));
boomDown.whileHeld(new ElevatorCommand(false,false));
boomDown.whenReleased(new ElevatorCommand(false,true));
rcUp.whileHeld(new RecycleContainerCommand(true,false));
rcUp.whenReleased(new RecycleContainerCommand(true,true));
rcDown.whileHeld(new RecycleContainerCommand(false,false));
rcDown.whenReleased(new RecycleContainerCommand(false,true));
}
public OI() {
joystick0 = new Joystick(0);
joystick1 = new Joystick(1);
joystick2 = new Joystick(2);
intakeOutButton = new JoystickButton(joystick0,1);
intakeOutButton.whileHeld(new IntakeOut());
elevatorUpAllTheWayButton = new JoystickButton(joystick0,6);
elevatorUpAllTheWayButton.whileHeld(new ElevatorUpAllTheWay());
elevatorDownAllTheWayButton = new JoystickButton(joystick0,7);
elevatorDownAllTheWayButton.whileHeld(new ElevatorDownAllTheWay());
intakeInButton = new JoystickButton(joystick1,1);
intakeInButton.whileHeld(new IntakeIn());
elevatorUpButton = new JoystickButton(joystick1,3);
elevatorUpButton.whileHeld(new ElevatorUp());
elevatorDownButton = new JoystickButton(joystick1,2);
elevatorDownButton.whileHeld(new ElevatorDown());
elevatorUpOperatorButton = new JoystickButton(joystick2,1);
elevatorUpOperatorButton.whileHeld(new ElevatorUpOperator());
elevatorUpAllTheWayButton2 = new JoystickButton(joystick2,6);
elevatorUpAllTheWayButton2.whileHeld(new ElevatorUpAllTheWay());
elevatorDownAllTheWayButton2 = new JoystickButton(joystick2,7);
elevatorDownAllTheWayButton2.whileHeld(new ElevatorDownAllTheWay());
SmartDashboard.putData("Autonomous",new Autonomous());
SmartDashboard.putData("IntakeIn",new IntakeIn());
SmartDashboard.putData("IntakeOut",new IntakeOut());
SmartDashboard.putData("ElevatorUp",new ElevatorUp());
SmartDashboard.putData("ElevatorDown",new ElevatorDown());
}
项目:turtleshell
文件:OI.java
public OI() {
// Put Some buttons on the SmartDashboard
SmartDashboard.putData("Elevator Bottom",new SetElevatorSetpoint(0));
SmartDashboard.putData("Elevator Platform",new SetElevatorSetpoint(0.2));
SmartDashboard.putData("Elevator Top",new SetElevatorSetpoint(0.3));
SmartDashboard.putData("Wrist Horizontal",new SetWristSetpoint(0));
SmartDashboard.putData("Raise Wrist",new SetWristSetpoint(-45));
SmartDashboard.putData("Open Claw",new OpenClaw());
SmartDashboard.putData("Close Claw",new CloseClaw());
SmartDashboard.putData("Deliver Soda",new Autonomous());
// Create some buttons
JoystickButton d_up = new JoystickButton(joy,5);
JoystickButton d_right= new JoystickButton(joy,6);
JoystickButton d_down= new JoystickButton(joy,7);
JoystickButton d_left = new JoystickButton(joy,8);
JoystickButton l2 = new JoystickButton(joy,9);
JoystickButton r2 = new JoystickButton(joy,10);
JoystickButton l1 = new JoystickButton(joy,11);
JoystickButton r1 = new JoystickButton(joy,12);
// Connect the buttons to commands
d_up.whenpressed(new SetElevatorSetpoint(0.2));
d_down.whenpressed(new SetElevatorSetpoint(-0.2));
d_right.whenpressed(new CloseClaw());
d_left.whenpressed(new OpenClaw());
r1.whenpressed(new PreparetoPickup());
r2.whenpressed(new Pickup());
l1.whenpressed(new Place());
l2.whenpressed(new Autonomous());
}
项目:FRC2015Code
文件:OI.java
public OI() {
// One joystick for xBox controller,two for otherwise.
switch (mode) {
case TRUAL_MODE: {
this.joystick = new Joystick[3];
// to-do,never.
break;
}
case DUAL_MODE: {
this.joystick = new Joystick[2];
this.joystick[leftJoystick] = new Joystick(0);
this.joystick[rightJoystick] = new Joystick(1);
this.shifterButton = new JoystickButton(joystick[0],3);
this.lifterButton = new JoystickButton(joystick[0],4);
this.liftUpButton = new JoystickButton(joystick[0],1);
this.liftDownButton = new JoystickButton(joystick[0],2);
this.grabberOpenButton = new JoystickButton(joystick[1],1);
this.grabberCloseButton = new JoystickButton(joystick[1],2);
this.compressorOnButton = new JoystickButton(joystick[1],3);
this.compressorOnButton = new JoystickButton(joystick[1],4);
break;
}
case XBox_MODE: {
this.joystick = new Joystick[1];
this.joystick[xBoxJoystick] = new Joystick(0);
this.lifterButton = new JoystickButton(joystick[0],1);
this.shifterButton = new JoystickButton(joystick[0],2);
this.liftUpButton = new JoystickButton(joystick[0],3);
this.liftDownButton = new JoystickButton(joystick[0],4);
this.grabberOpenButton = new JoystickButton(joystick[0],5);
this.grabberCloseButton = new JoystickButton(joystick[0],6);
this.compressorOnButton = new JoystickButton(joystick[0],8);
this.compressorOffButton = new JoystickButton(joystick[0],7);
break;
}
}
}
项目:Robot_2015
文件:Robot.java
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotinit() {
RobotMap.init();
// BEGIN AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
LiftControl.zerovalue = RobotMap.forkliftMotor.getPosition();
driveBase = new DriveBase();
pneumatics = new Pneumatics();
img = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB,0);
RobotMap.forkliftMotor.disableControl();
// END AUTOGENERATED CODE,SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
// OI must be constructed after subsystems. If the OI creates Commands
//(which it very likely will),subsystems are not guaranteed to be
// constructed yet. Thus,their requires() statements may grab null
// pointers. Bad news. Don't move it.
oi = new OI();
back = new JoystickButton(oi.joystick,7);
start = new JoystickButton(oi.joystick,8);
try {
cs = CameraServer.getInstance();
cs.setQuality( 10 );
/* The available size constants for cs.setSize are 0,1,2 for:
private static final int kSize640x480 = 0;
private static final int kSize320x240 = 1;
private static final int kSize160x120 = 2;
*/
// cs.setSize( 1 );
cs.startAutomaticCapture("cam0");
} catch (Exception e) {
// No camera signal,ignore
}
RobotMap.lightRing.set(true);
}
/**
* Receive a joystick and then map controls to it.
*
* @param joysticks The joysticks used for buttons
*/
public OI(GenericHID... joysticks) {
// button map
liftUpButton = new JoystickButton(joysticks[0],5);
liftDownButton = new JoystickButton(joysticks[0],3);
forkInButton = new JoystickButton(joysticks[0],1);
forkOutButton = new JoystickButton(joysticks[0],2);
extGrabButton = new JoystickButton(joysticks[0],6);
extThrowButton = new JoystickButton(joysticks[0],4);
reverseButton = new JoystickButton(joysticks[0],12);
// button controls
liftUpButton.whileHeld(new Lift(1));
liftDownButton.whileHeld(new Lift(-1));
liftUpButton.whenReleased(new Lift(0));
liftDownButton.whenReleased(new Lift(0));
forkInButton.whileHeld(new Fork(1));
forkOutButton.whileHeld(new Fork(-0.666));
forkInButton.whenReleased(new Fork(0));
forkOutButton.whenReleased(new Fork(0));
extGrabButton.whileHeld(new ExtArm(1));
extThrowButton.whileHeld(new ExtArm(-1));
extGrabButton.whenReleased(new ExtArm(0));
extThrowButton.whenReleased(new ExtArm(0));
reverseButton.whenpressed(new ReverseDrive());
}
项目:ProjectShifter
文件:OI.java
项目:TreeShirtCannon-2015
文件:OI.java