package org.usfirst.frc.team4272.robot2016; import org.usfirst.frc.team4272.robotlib.ToggleButton; import org.usfirst.frc.team4272.robotlib.PushButton; import org.usfirst.frc.team4272.robotlib.Xbox360Controller.Axis; import org.usfirst.frc.team4272.robotlib.Xbox360Controller.Button; import edu.wpi.first.wpilibj.Joystick; public class Teleop { private PushButton camButton = new PushButton(); public Teleop() { } private static double jsScale(Joystick j) { double y = -j.getY();/* +:forward; -:backward */ double z = -j.getZ();/* +:more-sensitive; -:less-sensitive */ return Math.copySign(Math.pow(Math.abs(y), 2.0-z), y); } public Control run(Control control, HwOI oi) { /* Drive */ control.lDrive = jsScale(oi.lStick); control.rDrive = jsScale(oi.rStick); /* Ball intake/shooter */ if (oi.lStick.getTrigger()) { control.fBall = control.bBall = -1; } else if (oi.rStick.getTrigger()) { control.fBall = 1; if (oi.rStick.getRawButton(3)) { control.bBall = 1; } } /* Take pictures */ if (camButton.update(oi.xbox.getButton(Button.RT))) { try { ProcessBuilder pb = new ProcessBuilder("/home/lvuser/tweeterbot/bin/snapPhoto"); pb.redirectErrorStream(true); pb.start(); } catch (Exception e) {}; } return control; } }