My code won't deploy because "startCompetion()" method in base

Were trying to deploy our command base structure code to our robot and it builds successfully, but gets an error during deployment.

our code is based on this video

our main error says "The startCompetition() method (or methods called by it) should have handled the exception above. "

It has an error saying “Warning  0  [phoenix-diagnostics] Server shutdown cleanly. (dur:0)  
Warning  0  [phoenix] Library shutdown cleanly ”

our motor controller are fully updated

I will provide our Robot code soon

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot;

import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;

/**

  • The VM is configured to automatically run this class, and to call the functions corresponding to
  • each mode, as described in the TimedRobot documentation. If you change the name of this class or
  • the package after creating this project, you must also update the build.gradle file in the
  • project.
    */
    public class Robot extends TimedRobot {
    private Command m_autonomousCommand;

private RobotContainer m_robotContainer;

/**

  • This function is run when the robot is first started up and should be used for any
  • initialization code.
    */
    @Override
    public void robotInit() {
    // Instantiate our RobotContainer. This will perform all our button bindings, and put our
    // autonomous chooser on the dashboard.
    m_robotContainer = new RobotContainer();
    }

/**

  • This function is called every 20 ms, no matter the mode. Use this for items like diagnostics
  • that you want ran during disabled, autonomous, teleoperated and test.
  • This runs after the mode specific periodic functions, but before LiveWindow and

  • SmartDashboard integrated updating.
    */
    @Override
    public void robotPeriodic() {
    // Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
    // commands, running already-scheduled commands, removing finished or interrupted commands,
    // and running subsystem periodic() methods. This must be called from the robot’s periodic
    // block in order for anything in the Command-based framework to work.
    CommandScheduler.getInstance().run();
    }

/** This function is called once each time the robot enters Disabled mode. */
@Override
public void disabledInit() {}

@Override
public void disabledPeriodic() {}

/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
@Override
public void autonomousInit() {
m_autonomousCommand = m_robotContainer.getAutonomousCommand();

// schedule the autonomous command (example)
if (m_autonomousCommand != null) {
  m_autonomousCommand.schedule();
}

}

/** This function is called periodically during autonomous. */
@Override
public void autonomousPeriodic() {}

@Override
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
}
}

/** This function is called periodically during operator control. */
@Override
public void teleopPeriodic() {}

@Override
public void testInit() {
// Cancels all running commands at the start of test mode.
CommandScheduler.getInstance().cancelAll();
}

/** This function is called periodically during test mode. */
@Override
public void testPeriodic() {}

/** This function is called once when the robot is first started up. */
@Override
public void simulationInit() {}

/** This function is called periodically whilst in simulation. */
@Override
public void simulationPeriodic() {}
}

Can you show a screenshot of the full error message?

# An error report file with more information is saved as: 
 # /tmp/hs_err_pid2045.log 
Warning  44007 84.717
FRC: Time since robot boot.ERROR  1  Unhandled exception: edu.wpi.first.hal.util.AllocationException: Code: -1029
PWM or DIO 1 previously allocated.
Location of the previous allocation:
at frc.robot.subsystems.DriveTrainSub.(DriveTrainSub.java:24)
at frc.robot.RobotContainer.(RobotContainer.java:32)
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:366)
at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:458)
at frc.robot.Main.main(Main.java:23)

Location of the current allocation:  frc.robot.subsystems.DriveTrainSub.(DriveTrainSub.java:27) 
Warning  1  The robot program quit unexpectedly. This is usually due to a code error.
The above stacktrace can help determine where the error occurred.
See for more information.  edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:380) 
ERROR  1  The startCompetition() method (or methods called by it) should have handled the exception above.  edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:387) 
Warning  0  [phoenix-diagnostics] Server shutdown cleanly. (dur:0)  
Warning  0  [phoenix] Library shutdown cleanly  
Warning  44007 84.737
Warning  44007 84.757
Warning  44007 84.777
Warning  44007 84.796
Warning  44007 84.816
Warning  44007 84.837
Warning  44007 84.856
Warning  44007 84.878
Warning  44007 84.898
Warning  44007 84.918
Warning  44007 84.936
Warning  44007 84.957
Warning  44007 84.977
Warning  44007 84.997
Warning  44007 85.017
Warning  44007 85.037
Warning  44007 85.056
FRC: Time since robot boot.Warning  44007 85.076
FRC: Time since robot boot.Warning  44008 79.046 78.046
FRC: Robot radio detection times.Internal issue with print and error tags
 ********** Robot program starting ********** 
 NT: Listening on NT3 port 1735, NT4 port 5810 
 NT: Got a NT4 connection from 10.61.10.191 port 59461 
 NT: CONNECTED NT4 client ‘Dashboard@1’ (from 10.61.10.191:59461) 
ERROR  1  Unhandled exception: edu.wpi.first.hal.util.AllocationException: Code: -1029
PWM or DIO 1 previously allocated.
Location of the previous allocation:
at frc.robot.subsystems.DriveTrainSub.(DriveTrainSub.java:24)
at frc.robot.RobotContainer.(RobotContainer.java:32)
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:366)
at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:458)
at frc.robot.Main.main(Main.java:23)

Location of the current allocation:  frc.robot.subsystems.DriveTrainSub.(DriveTrainSub.java:27) 
 Error at frc.robot.subsystems.DriveTrainSub.(DriveTrainSub.java:27): Unhandled exception: edu.wpi.first.hal.util.AllocationException: Code: -1029 
 PWM or DIO 1 previously allocated. 
 Location of the previous allocation: 
 at frc.robot.subsystems.DriveTrainSub.(DriveTrainSub.java:24) 
 at frc.robot.RobotContainer.(RobotContainer.java:32) 
 at frc.robot.Robot.robotInit(Robot.java:30) 
 at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:107) 
Warning  1  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.  edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:380) 
ERROR  1  The startCompetition() method (or methods called by it) should have handled the exception above.  edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:387) 
 at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:366) 
 at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:458) 
 at frc.robot.Main.main(Main.java:23) 
 
 Location of the current allocation: 
 at edu.wpi.first.hal.DIOJNI.initializeDIOPort(Native Method) 
 at edu.wpi.first.wpilibj.DigitalInput.(DigitalInput.java:35) 
 at edu.wpi.first.wpilibj.Encoder.(Encoder.java:142) 
 at edu.wpi.first.wpilibj.Encoder.(Encoder.java:101) 
 at edu.wpi.first.wpilibj.Encoder.(Encoder.java:113) 
 at frc.robot.subsystems.DriveTrainSub.(DriveTrainSub.java:27) 
 at frc.robot.RobotContainer.(RobotContainer.java:32) 
 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:366) 
 at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:458) 
 at frc.robot.Main.main(Main.java:23) 
 
 Warning at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:380): 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:387): The startCompetition() method (or methods called by it) should have handled the exception above. 
Warning  0  [phoenix-diagnostics] Server shutdown cleanly. (dur:0)  
Warning  0  [phoenix] Library shutdown cleanly  
 # 
 # A fatal error has been detected by the Java Runtime Environment: 
 # 
 # SIGSEGV (0xb) at pc=0xb6e9e01c, pid=2564, tid=2568 
 # 
 # JRE version: OpenJDK Runtime Environment (17.0.9.7) (build 17.0.9.7-frc+0-2024-17.0.9u7-1) 
 # Java VM: OpenJDK Client VM (17.0.9.7-frc+0-2024-17.0.9u7-1, mixed mode, emulated-client, serial gc, linux-arm) 
 # Problematic frame: 
 # C [libc.so.6+0x6c01c] 
 # 
 # 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_pid2564.log

This part is the issue. You are allocating the same DIO/PWM in two different places (the files/lines listed).

Thanks smh! turns out I assigned the same Encoder the value to the same value.

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