I have deployed my code to the driver station with no error, however Driver Station still says that there isn’t code. I tried reformatting the roboRIO, but the problem continues. I don’t see any error messages. The code I use is a command based Java program. Has anyone had this problem in the past that may have possible solutions?
Do you mean you deployed it to the roborio?
When you say there aren’t any error messages, do you mean from the deploy process, the DS console, or both?
Can you post a screenshot from VSCode showing the successful deployment? And a screenshot of the Diagnostics tab on the DriverStation?
I deployed the code in VSCode, which I think goes to the roboRio? When I talked about there being no error messages, I meant from the VSCode terminal and the DS terminal
I won’t be able to until tomorrow, I left the coding laptop at another location. I should have grabbed them in advance, but I didn’t think that far.
We’ll be here.
- Are you using VSCode and DriverStation on the same laptop?
- From the computer running DriverStation, can you reach the roboRIO Web Dashboard. (I don’t recommend experimenting with changing the settings here.)
- Are you sure your team number is set correctly everywhere? (We had a lot of issues at a recent off-season with second robots.)
- What do the status lights on the roboRIO say?
One thing @Molly_Connolly has pointed out to me several times I’ve made this error when using a new laptop as a driver station - make sure within the settings of the FRC Driver Station your team number is set. It should be the 3rd or 4th tab on the left of the DS window. (I don’t have it open in front of me).
I am pretty sure that our team number is the same everywhere
I had this problem recently. I’d recommend testing if you could deploy an empty project and see if it detects the code. My issue ended up being that my java version was out of date for one of the libraries.
For future reference, please give more context to your problem. Luckily for you, there are only a few reasons for this not to be working.
The think you should check first is if you are using the most recent RoboRIO image, VScode version, and have WPIlib up to date. If any of the components are out of date, your code might deploy, but not actually run (or show as nonexistent in DC).
If everything’s up to date, then see if you can deploy a completely empty project and enable the robot at all.
Next, try deploying code to another robot/RoboRIO. If it will run somewhere else, then it’s a RIO problem, not a code problem. Then you can re-image the RoboRIO and try again.
I have determined that everything is up to date. The empty project was detected and enabled in the DS.
Here is the screenshot of everything. I do use VSCode and DS on the same laptop. I was able to reach the Web dashboard through USB. I am sure that the team number is set correctly. I am noticing that the communication light on the roboRIO is solid red now.
Thanks. It looks like you are not successfully deploying your code.
I notice that VSCode is reporting one problem. Have you checked that out?
Can you show us a little more of the terminal log in VSCode above the "BUILD SUCCESSFUL? Sometimes VSCode isn’t doing the build you think it’s doing.
How are you triggering Deploy Robot Code?
I have checked out that error. It’s a resource leak for our analog potentiometer. I was informed that it didn’t matter based on the situation. I have triggered the build using shift + F5 to deploy it. I have used the WPILib symbol in the top right corner to find and try the deploy and build options.
So it might be that your deploy works, but the code crashes “immediately” on the Rio. If you know your way around Linux, you can log into the Rio with SSH and see if it is running. I don’t remember how to figure it out beyond that.
The program is starting, as shown by the RioLog window (“Robot program starting”). The most likely cause is there’s something causing the code to hang (or less likely, crash) when the main Robot class is being created or in robotInit(). The template only tells the DS code is running after those two things happen (at which point it also prints out “Robot program startup complete”). We’d have to see your full code to help trace this further.
As Peter_Johnson pointed out your robotInit()
started but didn’t finish. Put a System.out.println("1"); then"2", "3"
, between every statement and you’ll likely see which statement fails to complete.
I suggest you look at both the riolog and the DriverStation console for your debugging output. They sometimes differ with the console being more reliable but you can’t scroll back as far.
void robotInit()
{
System.out.println(“starting my robotInit”);
a statement
System.out.println(“finished statement 1”);
a statement
System.out.println(“finished statement 2”);
.
.
.
System.out.println(“end robotInit”);
}
Actually, re-examining your screenshot, I think the issue is right there–the while loop in the constructor. The constructor isn’t going to finish until that while loop condition is satisfied. In general robot code should not use while loops / waits for conditions, and that line in particular looks like it’s misplaced anyway (why is that operation being done in the constructor?)
I think the issue is related to a while() statement in a subsystem. I found that when I replaced it with an IF statement, there is no issue and I can enable the robot in the DS. I believe that how I have the while() statement set up is possibly causing the code to crash immediately and not be detected by the DS.
I’ll be honest, I didn’t know if the loop was supposed to go there. I don’t have that much experience in java coding (I have more than our team lead at this point.) The robot I’m coding is command based, which I have come to know is apparently a lot harder.