Go to Post Upon entering FIRST you immediately apply Murphy's Laws. - A_Reed [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-11-2015, 17:40
team8 team8 is offline
Registered User
FRC #0008
 
Join Date: Nov 2015
Location: California
Posts: 6
team8 is an unknown quantity at this point
Help with deploying Java

This year we are trying to switch to Java, and have already rewrote our existing C++ code in Java. When we initially tried to deploy Java to our robot, we encountered a deploy error. This was rectified when we downloaded the JVM and deploying now executes without errors. However, the driver station says "no robot code" after deploying. Does anyone have a comprehensive checklist of things that must be done in order to deploy Java code to the roborio successfully? Our code is here: https://github.com/team8/jFreyja/tree/controller
Thanks.

Last edited by team8 : 14-11-2015 at 17:46.
Reply With Quote
  #2   Spotlight this post!  
Unread 14-11-2015, 19:14
Lireal Lireal is offline
Registered User
AKA: Alex Colello
FRC #2141 (Spartonics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Concord, California
Posts: 113
Lireal has a spectacular aura aboutLireal has a spectacular aura aboutLireal has a spectacular aura about
Re: Help with deploying Java

Are there any error messages on the right side of the driverstation? (clear the log and redownload it to make sure)
Reply With Quote
  #3   Spotlight this post!  
Unread 14-11-2015, 19:22
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Help with deploying Java

If the download succeeds you are likely seeing an exception. I would try the advice about the DS messages window above first. If that doesn't work I would try rioLog: http://wpilib.screenstepslive.com/s/...console-output
Reply With Quote
  #4   Spotlight this post!  
Unread 15-11-2015, 18:19
team8 team8 is offline
Registered User
FRC #0008
 
Join Date: Nov 2015
Location: California
Posts: 6
team8 is an unknown quantity at this point
Re: Help with deploying Java

The error messages on the right side of the driverstation are below.

➔ Launching «'/usr/local/frc/JRE/bin/java' '-jar' '/home/lvuser/FRCUserProgram.jar'»
edu.wpi.first.wpilibj.networktables2.server.Server ConnectionAdapter@881f78 entered connection state: GOT_CONNECTION_FROM_CLIENT
edu.wpi.first.wpilibj.networktables2.server.Server ConnectionAdapter@881f78 entered connection state: CONNECTED_TO_CLIENT
Drivetrain constructor called
ERROR Unhandled exception: edu.wpi.first.wpilibj.util.AllocationException: PWM channel 0 is already allocated at [edu.wpi.first.wpilibj.PWM.initPWM(PWM.java:126), edu.wpi.first.wpilibj.PWM.<init>(PWM.java:145), edu.wpi.first.wpilibj.SafePWM.<init>(SafePWM.java: 33), edu.wpi.first.wpilibj.Victor.<init>(Victor.java:54 ), org.usfirst.frc.team8.subsystems.Lifter.<init>(Lif ter.java:24), org.usfirst.frc.team8.robot.Robot.robotInit(Robot. java:33), edu.wpi.first.wpilibj.IterativeRobot.startCompetit ion(IterativeRobot.java:76), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.jav a:234)]
WARNING: Robots don't quit!
---> The startCompetition() method (or methods called by it) should have handled the exception above.
Reply With Quote
  #5   Spotlight this post!  
Unread 15-11-2015, 18:41
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Help with deploying Java

At the risk of being unhelpful, this one should be pretty straightforward to find and it's important to learn how to debug these.

Start with the error itself
Quote:
ERROR Unhandled exception: edu.wpi.first.wpilibj.util.AllocationException: PWM channel 0 is already allocated
Then look towards the end of the call chain (the text after the error I quoted) to figure out where in the code the error is happening. That should help you figure out what's going on. If you can't figure it out, let us know and I or someone else can help more (I did find the error in the code).
Reply With Quote
  #6   Spotlight this post!  
Unread 15-11-2015, 20:54
team8 team8 is offline
Registered User
FRC #0008
 
Join Date: Nov 2015
Location: California
Posts: 6
team8 is an unknown quantity at this point
Re: Help with deploying Java

I did look into this, and I thought that the error was conflicting port numbers. So I went to line 25 in lifter, and changed that port around to many different numbers. However, each time I would redeploy and the same error would occur, which confused me. Any thoughts? Thanks.

EDIT: This was after some changes to ports were made on the driver station, which unfortunately aren't pushed. The new error is basically the same as the old one, except it is on line 25 in lifter and complains that PWM 1 is allocated. However, changes to the port on line 25 in lifter have no effect.

Last edited by team8 : 15-11-2015 at 20:58. Reason: Forgot to push changes on driver station
Reply With Quote
  #7   Spotlight this post!  
Unread 15-11-2015, 22:07
team8 team8 is offline
Registered User
FRC #0008
 
Join Date: Nov 2015
Location: California
Posts: 6
team8 is an unknown quantity at this point
Re: Help with deploying Java

After looking a bit more closely, we understand a bit more on what the PWM issue is about. However we aren't sure if there is a step we are missing in the initialization of our Victors/Talons etc. We thought that changing ports would help fix it, but we haven't figured out which ports are conflicting?

Also we have no idea what the start competition method is or is supposed to be, there was no such method in C++ as far as we recall.

In general are there some resources that go beyond the documentation or sample iterative robot code we could look at?
Reply With Quote
  #8   Spotlight this post!  
Unread 15-11-2015, 22:09
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Help with deploying Java

The error is conflicting port numbers. Something is opening PWM 0 before Lifter is (or PWM 1 after you changed it).

PWM 0-3 are assigned to the drivetrain based on lines 11-14 of /robot/Ports.java and lines 75-78 of /subsytems/drivetrain.java

Is there a reason lifter.java is not using PORT_LIFTER_VICTOR_1 and PORT_LIFTER_VICTOR_2 from Ports.java?

Changing the port on the line causing the exception must have an effect if the change is saved, builds properly and deploys properly, the exception clearly reports the line it occurs on. At a minimum making a change should change the port with a conflict, if you pick a port that is actually free it will clear the exception.

EDIT: StartCompetition exists in C++ as well, you just never went looking for it. The differences between the C++ and Java versions of WPILib are pretty small, the C++ equivalent of the code you have here would fail in a very similar manner.

Last edited by RufflesRidge : 15-11-2015 at 22:11.
Reply With Quote
  #9   Spotlight this post!  
Unread 17-11-2015, 00:04
team8 team8 is offline
Registered User
FRC #0008
 
Join Date: Nov 2015
Location: California
Posts: 6
team8 is an unknown quantity at this point
Re: Help with deploying Java

The latest code has now been pushed, I did indeed find some port conflicts which have now been fixed. Thanks guys! I will test tomorrow and get back to you all.
Reply With Quote
  #10   Spotlight this post!  
Unread 17-11-2015, 19:52
team8 team8 is offline
Registered User
FRC #0008
 
Join Date: Nov 2015
Location: California
Posts: 6
team8 is an unknown quantity at this point
Re: Help with deploying Java

So when I pulled the new code and tried to deploy, the same error appeared. We managed to get the robot code to appear and run after we commented out the lifter though.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:50.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi