Program Problem

I tried to use pid to make our arm to the specific position.

  • The robot program quit unexpectedly. This is usually due to a code error.
    The above stacktrace can help determine where the error occurred.
    See Reading Stacktraces — FIRST Robotics Competition documentation for more information.

  • at frc.robot.RobotContainer.(RobotContainer.java:28)

  • at frc.robot.Robot.robotInit(Robot.java:30)

  • at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:106)

  • at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:343)

  • at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:433)

  • The startCompetition() method (or methods called by it) should have handled the exception above.

  • at frc.robot.Main.main(Main.java:23)

  • Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:358): The robot program quit unexpectedly. This is usually due to a code error.

  • The above stacktrace can help determine where the error occurred.

  • See Reading Stacktraces — FIRST Robotics Competition documentation for more information.

  • Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:365): The startCompetition() method (or methods called by it) should have handled the exception above.

  • ********** Robot program starting **********

  • NT: could not open persistent file ‘/home/lvuser/networktables.json’: No such file or directory

  • NT: Listening on NT3 port 1735, NT4 port 5810

  • NT: Got a NT4 connection from 10.77.9.231 port 60545

  • NT: CONNECTED NT4 client ‘shuffleboard’ (from 10.77.9.231:60545)

  • Unhandled exception: java.lang.NullPointerException: Cannot invoke “com.revrobotics.SparkMaxPIDController.setP(double)” because “this.t_PID” is null

  • Error at frc.robot.subsystems.TelecopeSubsystem.(TelecopeSubsystem.java:26): Unhandled exception: java.lang.NullPointerException: Cannot invoke “com.revrobotics.SparkMaxPIDController.setP(double)” because “this.t_PID” is null

  • The robot program quit unexpectedly. This is usually due to a code error.
    The above stacktrace can help determine where the error occurred.
    See Reading Stacktraces — FIRST Robotics Competition documentation for more information.

  • The startCompetition() method (or methods called by it) should have handled the exception above.

  • at frc.robot.subsystems.TelecopeSubsystem.(TelecopeSubsystem.java:26)

  • at frc.robot.RobotContainer.(RobotContainer.java:28)

  • at frc.robot.Robot.robotInit(Robot.java:30)

  • at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:106)

  • at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:343)

  • at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:433)

  • at frc.robot.Main.main(Main.java:23)

  • Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:358): The robot program quit unexpectedly. This is usually due to a code error.

  • The above stacktrace can help determine where the error occurred.

  • See Reading Stacktraces — FIRST Robotics Competition documentation for more information.

  • Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:365): The startCompetition() method (or methods called by it) should have handled the exception above.

Have you read through the page linked in that output? It’ll help immensely.

Please share your code. Ideally as a link to github or similar.

The stack trace is telling you everything you need to know.

There is a null pointer error at line 26 in your TelecopeSubsystem (telescope?). You are referencing some object called t_PID which is null. This throws a fatal error. Make sure that you are actually assigning the t_PID object to something.

It would be helpful if you would share your code. It looks like the GitHub you linked contains compiled .class files, which are not super useful for debugging (at least I can’t read them :man_shrugging:) if you could post your raw code that would be good.

I’ve found the problem.I forgot to write:" t_PID = t_turnmotor.getPIDController();".

1 Like

Awesome! Glad you were able to find the bug. Following the stack trace is always a good idea. It’ll usually tell you whats wrong and where.