When deploying my robot code to our robot, I have an error mentioning the index of Joystick. This is my first time using a flight stick to control a drivetrain, so the code might not be set up correctly. The text below is what shows up in the console as soon as I deploy code, and the code builds successfully but doesn’t work after that. Even after deploying the code, the driverstation says that there is no robot code. I was wondering what I needed to do to fix it.
(I can’t figure out how to upload the entire code to github so I was only able to upload src/main/)
********** Robot program starting **********
NT: server: client CONNECTED: 10.68.94.174 port 55564
Unhandled exception: java.lang.IllegalArgumentException: Joystick index is out of range, should be 0-3
Error at frc.robot.RobotContainer.(RobotContainer.java:44): Unhandled exception: java.lang.IllegalArgumentException: Joystick index is out of range, should be 0-3
at edu.wpi.first.wpilibj.DriverStation.getStickButton(DriverStation.java:434)
at edu.wpi.first.wpilibj.GenericHID.getRawButton(GenericHID.java:91)
at edu.wpi.first.wpilibj2.command.button.JoystickButton.get(JoystickButton.java:36)
The robot program quit unexpectedly. This is usually due to a code error.
The above stacktrace can help determine where the error occurred.
See https://wpilib.org/stacktrace for more information.
The startCompetition() method (or methods called by it) should have handled the exception above.
from: edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:395)
at edu.wpi.first.wpilibj2.command.button.Trigger$2.(Trigger.java:142)
at edu.wpi.first.wpilibj2.command.button.Trigger.whileActiveContinuous(Trigger.java:139)
at edu.wpi.first.wpilibj2.command.button.Trigger.whileActiveContinuous(Trigger.java:170)
at edu.wpi.first.wpilibj2.command.button.Button.whileHeld(Button.java:98)
at frc.robot.RobotContainer.(RobotContainer.java:44)
at frc.robot.Robot.robotInit(Robot.java:30)
at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:107)
at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:373)
at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:463)
at frc.robot.Main.main(Main.java:23)
Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:388): The robot program quit unexpectedly. This is usually due to a code error.
The above stacktrace can help determine where the error occurred.
See https://wpilib.org/stacktrace for more information.
Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:395): The startCompetition() method (or methods called by it) should have handled the exception above.
NT: server: client CONNECTED: 10.68.94.11 port 50938
[phoenix-diagnostics] Server shutdown cleanly. (dur:10|0)
[phoenix] Library shutdown cleanly
[phoenix-diagnostics] Server shutdown cleanly. (dur:10|0)
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0xb6e3e3d8, pid=4695, tid=4701
JRE version: OpenJDK Runtime Environment (11.0.12.5) (build 11.0.12.5-frc+0-2022-11.0.12u5-1)
Java VM: OpenJDK Client VM (11.0.12.5-frc+0-2022-11.0.12u5-1, mixed mode, concurrent mark sweep gc, linux-)
[thread 4735 also had an error]
Problematic frame:
C [libc.so.6+0x6c3d8]
No core dump will be written. Core dumps have been disabled. To enable core dumping, try “ulimit -c unlimited” before starting Java again
An error report file with more information is saved as:
/tmp/hs_err_pid4695.log
[thread 4733 also had an error]