Stacktrace doesn't show where the source of a fatal error is

We’re running into a problem with a fatal error, but the stacktrace says “Unknown Source”

We tried running the code, but the robot wasn’t responding to joystick inputs, so we added a print statement to check if the joystick inputs were reaching the code. After adding this line, the code broke.

package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.Drivetrain;
import frc.robot.subsystems.OI;

public class TeleopTankDrive extends CommandBase {
  private Drivetrain m_drive;
  private OI m_oi;

  /** Creates a new TankDriveTeleop. */
  public TeleopTankDrive(Drivetrain drive, OI oi) {
     m_drive = drive;
     m_oi = oi;

     addRequirements(drive);
     // Use addRequirements() here to declare subsystem dependencies.
  }

  // Called when the command is initially scheduled.
  @Override
  public void initialize() {}

  // Called every time the scheduler runs while the command is scheduled.
  @Override
  public void execute() {
    m_drive.SetMotorsXY(m_oi.getLeftX(), m_oi.getLeftY()); 

   //System.out.println(m_oi.getLeftY()); <---- This is the line we added
 }
...

Even after commenting out the line we added, the code was still broken.

Here’s the stacktrace:

from java.base/java.util.ImmutableCollections$SetN.probe(Unknown Source)
  at java.base/java.util.ImmutableCollections$SetN.probe(Unknown Source)
  at java.base/java.util.ImmutableCollections$SetN.<init>(Unknown Source)
  at java.base/java.util.Set.of(Unknown Source)
  at edu.wpi.first.wpilibj2.command.CommandBase.addRequirements(CommandBase.java:32)
  at frc.robot.commands.ToggleIntakeExtend.<init>(ToggleIntakeExtend.java:31)
  at frc.robot.RobotContainer.configureButtonBindings(RobotContainer.java:63)
  at frc.robot.RobotContainer.<init>(RobotContainer.java:47)
  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)

I think it’s unlikely that your print changed anything. I would look at these two lines:

If I had to guess, a subsystem you’re passing to the ToggleIntakeExtend command on RobotContainer line 63 is null.

Ensure you’re running the v4.0 image with WPILib 2022.3.1 or later.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.