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;

     // Use addRequirements() here to declare subsystem dependencies.

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

  // Called every time the scheduler runs while the command is scheduled.
  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(
  at frc.robot.commands.ToggleIntakeExtend.<init>(
  at frc.robot.RobotContainer.configureButtonBindings(
  at frc.robot.RobotContainer.<init>(
  at frc.robot.Robot.robotInit(
  at edu.wpi.first.wpilibj.TimedRobot.startCompetition(
  at edu.wpi.first.wpilibj.RobotBase.runRobot(
  at edu.wpi.first.wpilibj.RobotBase.startRobot(
  at frc.robot.Main.main(

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.