I’m currently receiving yet another insantion error and I can’t seem to fix it. The code was functional until I added the intakeShooter File series.
This might also have something to do with the fact I’m trying to use a parallel command group to run both our teleop driving features and our teleop shooter features at the same time.
But the most likely cause is one of the new files I added is being declared far too early.
If anyone wishes to take a deeper look at the error run the ./gradlew simulateJava command in terminal.
Error at frc.robot.RobotContainer.configureButtonBindings(RobotContainer.java:33): Unhandled exception instantiating robot edu.wpi.first.wpilibj2.command.CommandScheduler java.lang.IllegalArgumentException: Default commands should not end!
at edu.wpi.first.wpilibj2.command.CommandScheduler.setDefaultCommand(CommandScheduler.java:364)
at edu.wpi.first.wpilibj2.command.Subsystem.setDefaultCommand(Subsystem.java:50)
at frc.robot.RobotContainer.configureButtonBindings(RobotContainer.java:33)
at frc.robot.RobotContainer.<init>(RobotContainer.java:43)
at frc.robot.Robot.<clinit>(Robot.java:39)
at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:322)
at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$0(RobotBase.java:443)
at java.base/java.lang.Thread.run(Thread.java:829)
Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:336): 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:342): Could not instantiate robot edu.wpi.first.wpilibj2.command.CommandScheduler!
Don’t use your teleop sequence. Instead just have 2 different default commands. It doesn’t look like Mecanum drive and intakeshooter share any requirements.
You are limited to 1 default per subsystem not 1 per robot.
Default command is something that runs continuously while a subsystem is not executing any other command. Each subsystem can have a default command. Like:
I implemented the change you suggested inside the Robot Container file (Github Updated)
but now I’m receiving the following error. Its depended on the order im instantiating my variables, but no order seems to work. Any ideas?
Error:
Error at frc.robot.RobotContainer.configureButtonBindings(RobotContainer.java:35): Unhandled exception instantiating robot edu.wpi.first.wpilibj2.command.CommandScheduler java.lang.IllegalArgumentException: Default commands must require their subsystem!
at edu.wpi.first.wpilibj2.command.CommandScheduler.setDefaultCommand(CommandScheduler.java:360)
at edu.wpi.first.wpilibj2.command.Subsystem.setDefaultCommand(Subsystem.java:50)
at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$0(RobotBase.java:443)
at java.base/java.lang.Thread.run(Thread.java:829)
Error at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:336): 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:342): Could not instantiate robot edu.wpi.first.wpilibj2.command.CommandScheduler!
I completly restarted and now its working properly
Thanks!
This was actually a huge help. I had no idea you could have two default commands which was incredibly helpful.
Sidenote while i’ve still got you here. Do you know what this warning might be referring to?
Warning:
Warning at edu.wpi.first.wpilibj.DriverStation.reportJoystickUnpluggedWarning(DriverStation.java:1489): Joystick axis 4 on port 0 not available, check if controller is plugged in
The keyboard only has axis 0 and 1. You are referencing axis 4. When I swap my xbox controller (or anything else that has axis 4) in place of the keyboard for joystick[0] the warning goes away.
Assuming you don’t have a xbox or similar available you can go to DS->Keyboard Setting->Add additional axis until you have 4 showing.