Java Code Doesn't Work on Certain Computers

Currently, my team is building a 2nd robot as practice. It has 2 Drivetrain motors (its motor controllers are Sparks) and 1 motor (arm motor) acting as a pivot for an arm (its motor controllers is a Talon). Another member and I are typing code on 2 separate computers using Java on Eclipse. Unlike him, however, I’m experiencing problems with making the code that controls the arm motor operate correctly on the robot using my computer.

In my test code, I made an Arm and Drivetrain Subsystem. I also made Commands that drove the Drivetrain, moved the arm motor left manually, and moved the arm motor right manually. The other member wrote very similar code to mine. So when testing it, both of our Drivetrain code worked properly. When I tested the arm motor code (which was set to activate when I held either L2 or R2 on a PS4 controller), it caused the code to deactivate immediately. His arm motor code worked though. So, after hours of comparing my code to his (to a point where our code was identical), we transferred his code to my computer to try to find the problem. Surprisingly, though, it still didn’t work!

Me and the other member aren’t sure what’s going on. I believe it has to be my computer, not the code (being that it worked on the other member’s computer, but not mine). If that’s the case, then I’m not sure how to fix it. Please share your opinions/advice with me, it would be greatly appreciated. Thank you!

Hmm, it sure seems like an interesting problem. I would have recommended you to double check your code but you claim that working code on another computer doesn’t work on yours.

There are a bunch of things that I would recommend and these might help:

  • Reinstall the Driver Station
  • Reinstall the Eclipse Plugins (corrupted deploy?)
  • Reinstall Java

If the code color turns “red” on the Driver Station, check your console to see if there are any exceptions or if the JVM has crashed. However, these might be unlikely seen as the code itself ran fine from the other computer.

Please update us if there are any additional symptoms that could trace the cause of this issue.

A Talon SRX over CAN? If so, I would suspect you either don’t have the CTRE library (Phoenix Framework) on your computer or have a different version than what’s on the roboRIO. Make sure all computers you are using to program have the same version of the CTRE libraries.

When you say you are using two separate computers, I assume you mean each of you are running a DriverStation and trading off who’s connected to the robot. Otherwise it’s almost nonsensical that the same code, deployed from two different computers, causes the robot to crash.

If you use GitHub a link to your code would be good.

A shot in the dark, assuming my first assumption: Make sure your PS4 controller acts the same on both computers. When you click the USB tab in the driver station, you should be able to see the buttons and analog sticks.