|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help ME PLEASE ASAP
Can someone please fix my code or point me in the right direction so i can use a xbox controller to drive. tank drive or arcade drive it doesnt matter
public class Robot extends IterativeRobot { RobotDrive drive = new RobotDrive(1,2,3,4); Joystick mXboxController = new Joystick(0); Joystick controlStick = new Joystick(1); Talon frontLeft = new Talon(4); Talon rearLeft = new Talon(3); Talon frontRight = new Talon(2); Talon rearRight = new Talon(1); public void robotInit() { drive = new RobotDrive(0,1,2,3); mXboxController = new Joystick(0); controlStick = new Joystick(1); frontLeft = new Talon(1); frontLeft.enableDeadbandElimination(true); frontLeft.set(+1.0); rearLeft = new Talon(2); rearLeft.enableDeadbandElimination(true); rearLeft.set(-1.0); frontRight = new Talon(3); frontRight.enableDeadbandElimination(true); frontRight.set(+1.0); rearRight = new Talon(4); rearRight.enableDeadbandElimination(true); rearRight.set(-1.0); } public void autonomousInit() { drive = new RobotDrive(1,2,3,4); frontLeft = new Talon(1); frontLeft.enableDeadbandElimination(true); frontLeft.set(-1.0); rearLeft = new Talon(2); rearLeft.enableDeadbandElimination(true); rearLeft.set(+1.0); frontRight = new Talon(3); frontRight.enableDeadbandElimination(true); frontRight.set(-1.0); rearRight = new Talon(4); rearRight.enableDeadbandElimination(true); rearRight.set(+1.0); } public void autonomousPeriodic() { while (isAutonomous() && isEnabled()) { drive.setSafetyEnabled(true); drive.drive(-0.5,0.0); Timer.delay(5); drive.drive(0.0,0.0); } } public void teleopInit(){ drive = new RobotDrive(1,2,3,4); mXboxController = new Joystick(0); controlStick = new Joystick(1); frontLeft = new Talon(1); frontLeft.enableDeadbandElimination(true); frontLeft.set(-1.0); rearLeft = new Talon(2); rearLeft.enableDeadbandElimination(true); rearLeft.set(+1.0); frontRight = new Talon(3); frontRight.enableDeadbandElimination(true); frontRight.set(-1.0); rearRight = new Talon(4); rearRight.enableDeadbandElimination(true); rearRight.set(+1.0); } public void teleopPeriodic() { while (isOperatorControl() && isEnabled()) { drive.setSafetyEnabled(true); double speedControl = 1; double joystickLeftY = mXboxController.getRawAxis(1)*speedControl; double joystickLeftX = mXboxController.getRawAxis(0)*-1*speedControl; drive.arcadeDrive(joystickLeftY, joystickLeftX); |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|