Debugging Techniques

My team and I are trying to figure out how to debug. Also When we use System.out.println were does it print to. It’s not going to NetBeans or the Control Center. Any help would be awesome!

It should be going to the build process window. If you have it hidden you might not have seen it.

I don’t see it. :confused:

Once you hit run, you should see the messages of it compiling and trying to flash the cRIO’s memory in a window. Any printlns should appear there.

If they don’t, I’m surprised you can program it at all.

Yes, it should appear in your NetBeans console if you loaded the code from there. If the code was loaded from another computer or from another machine, your NetBeans doesn’t know about it. You can launch the “net console” on the machine with the Driver Station to force the System.out results to go there. (I just learned this yesterday! We’d always used NetBeans last year.)

Alternative forms of debugging are to send small output to the DashBoard (or better yet this year’s SmartDashboard.) System.out is usually simpler though.

Remember to take out the System.outs when you are done as output slows down the code. (I/O takes longer than CPU.)

MaK211 Team can not debug either. We can compile and download code which will run. But when we compile and download through the Netbeans debugger the PC just hangs. We do see the download and the reboots. In the 2010 version (Pre 2011 Upgrade) we would eventually get a message stating waiting for connection. In the 2011 version we get nada. The dashboard shows no program code. If we right click on the Debug Project Icon and select Attach there is no port specified on the form and the OK button is grayed out. We have not been able to find any 2011 instructions for debugging in Java with Netbeans.

All ideas are welcome. :slight_smile:

What happens is that once the code compiles and sends we leave it connected to the robot we launch the Classmate DriveStation and run out program. Nothing logs on NetBeans.

For normal program execution we do that too. Download code, see it on the dashboard, then set to Autonomous or Teleoperated…

Its only when we want to set a breakpoint and launch the debugger do we have an issue where the laptop with the debugger on it doesn’t get to the point where the debugger runs. Nor does the dashboard application see the robot code deploy. It shouldn’t because the debugger is not running yet. We still need help with how to get the debugger to run.

So we just started playing with CAN today (Java and CAN-Serial converter) but now we can’t see the println’s anymore because the console out is disabled.

How do other teams debug code with out print statements?

That is the only system I have used for FIRST robots.

Setting up a dashboard doesn’t seem to give the same information. We know we can do file out but we can’t get live updates while the robot is running.

Has anyone else found a simple solution to this problem?

Edited: I got the printlns working again, not really sure what the problem is but now CAN won’t work getting an error when I try to initialize any jaguars: “edu.wpi.first.wpilibj.util.UncleanStatusException: Fatal status code detected: -1”

There’s a net console if you’re using CAN. I’m using the eclipse plugin and it automatically shows it. If it doesn’t open a terminal cd into the project directory and run “ant echo” and you should get output. You need to make sure you’re on the right netmask is 255.0.0.0 for whatever reason, my router dynamically assigns me 255.255.255.0 sometimes.

The one problem I’ve had with netconsole is if you print to fast, the router gets slow and it can cause issues so just limit the rate at which you print.

That should be greatly improved by the v27 image. The NetConsole server now batches output into larger packets.

Thanks! That is great to know.

we’re new to java this year and trying to get the debugger to run. we’re having the same experience as ksanger described here. was there ever a solution found?

Wendy; We never did get the debugger to work. Our team is just starting up again this fall and maybe we’ll get to try again in a month or two. Good luck and welcome to USFirst Robotics.

ok thanks. i have new info and more questions.

since i wasn’t able to get the debugger to work, i tried hard wiring it instead of doing it through wifi. that seemed to work fine.

does this mean that we have to be hard wired to debug? my common sense tells me that this is not practical. i should not have to follow our robot around with my laptop connected in order to debug code, right?

are there teams out there that can attach a debugger through wireless connection? if so, any help is much appreciated.

this is what is displayed in the output window.

in the debugger console:
Attaching to Wendy:2900
then it just sits there forever.

in the Team3502 (deploy,debug-run) Window:

init:
init:
Deleting directory C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\build
Deleting directory C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite
Deleting directory C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\j2meclasses
clean:
Created dir: C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\build
Compiling 2 source files to C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\build
compile:
Created dir: C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\j2meclasses
preverify:
Created dir: C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite
Building jar: C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite\Team3502_1.0.0.jar
jar-app:
CompilerOracle: exclude com/sun/squawk/Method.getParameterTypes
CompilerOracle: exclude com/sun/squawk/SymbolParser.getSignatureTypeAt
CompilerOracle: exclude com/sun/squawk/SymbolParser.stripMethods
[translating suite image [closed: false, parent: squawk] …]

Excluding compile: com.sun.squawk.Method::getParameterTypes

Excluding compile: com.sun.squawk.SymbolParser::getSignatureTypeAt

[Including resource: META-INF/MANIFEST.MF]
Romizer processed 113 classes and generated 4 files.
Expanding: C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite\Team3502_1.0.0.jar into C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite
Moving 1 file to C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite
Moving 1 file to C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite
Moving 1 file to C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\suite
Deleting: C:\Documents and Settings\Wendy Chan\My Documents\NetBeansProjects\Team3502Robot runk\Team3502\image.suite.api
Host OS: Windows XP 5.1, 5.1
Host JVM: Java HotSpot™ Client VM 19.1-b02
Target IP: 10.35.2.2
Network interfaces on host:
Intel® PRO/Wireless 3945ABG Network Connection - McAfee Core NDIS Intermediate Filter Miniport: address: 10.35.2.4 netmask: 255.0.0.0 <— on robot’s subnet
Connecting FTP @10.35.2.2
upgrade:
Sending local file image.suite
flashapp:
deploy:
debug-run:
do-debug-run:
[cRIO] [OTA Server] ********* REBOOTING cRIO *********
[cRIO]
Waiting for cRIO to reboot (1s)
Waiting for cRIO to reboot (2s)
Waiting for cRIO to reboot (3s)
Waiting for cRIO to reboot (4s)
Waiting for cRIO to reboot (5s)
Waiting for cRIO to reboot (6s)
Waiting for cRIO to reboot (7s)
[cRIO]
Connect debugger attempt 1
Connecting NetBeans debugger
Start debug proxy
init:
CompilerOracle: exclude com/sun/squawk/Method.getParameterTypes
CompilerOracle: exclude com/sun/squawk/SymbolParser.getSignatureTypeAt
CompilerOracle: exclude com/sun/squawk/SymbolParser.stripMethods
Trying to connect to VM on socket://10.35.2.2:2800
[cRIO] -> * Loading StartupDlls: debug
[cRIO] Entering debug.o StartupLibraryInit
[cRIO] Debugging is up, target server mounted at /tsfs
[cRIO]
[cRIO]
[cRIO] VxWorks
[cRIO]
[cRIO] Copyright 1984-2006 Wind River Systems, Inc.
[cRIO]
[cRIO] CPU: MPC5200 – Wind River Lite5200 BSP.
[cRIO] Runtime Name: VxWorks
[cRIO] Runtime Version: 6.3
[cRIO] BSP version: 2.0/10
[cRIO] Created: Jul 29 2009, 13:41:47
[cRIO] ED&R Policy Mode: Deployed
[cRIO] WDB Comm Type: WDB_COMM_END
[cRIO] WDB: Ready.
[cRIO]
[cRIO] Leaving debug.o StartupLibraryInit
[cRIO] * Loading StartupDlls: NiRioRpc
[cRIO] * Loading StartupDlls: niorbs
[cRIO] * Loading StartupDlls: NiViSrvr
[cRIO] * Loading StartupDlls: visa32
[cRIO] * Loading StartupDlls: nivissvc
[cRIO] task 0xed1418 (PAL00fa27d0) deleted: errno=0 (0) status=0 (0)
[cRIO] NI-RIO Server 3.2 started successfully.
[cRIO] task 0xc4c8b8 (NiRioRpc) deleted: errno=0 (0) status=0 (0)
[cRIO] * Loading StartupDlls: nivision
Connect debugger attempt 2
Connecting NetBeans debugger
[cRIO] * Loading StartupDlls: niserial
[cRIO] * Loading StartupDlls: FRC_FPGA
[cRIO] * Loading StartupDlls: FRC_NetworkCommunication
[cRIO] task 0x1af5638 (t2) deleted: errno=0 (0) status=0 (0)
[cRIO] FRC_NetworkCommunication was compiled from SVN revision 2258
[cRIO]
[cRIO] NI-VISA Server 4.5 started successfully.
[cRIO] task 0xe4fbe0 (t1) deleted: errno=1835009 (0x1c0001) status=1 (0x1)
Attached JPDA debugger to localhost:2900
[cRIO] FPGA Hardware GUID: 0x2EAA5E59CAF1A8A966853A011B61CC91
[cRIO] FPGA Software GUID: 0x2EAA5E59CAF1A8A966853A011B61CC91
[cRIO] FPGA Hardware Version: 2011
[cRIO] FPGA Software Version: 2011
[cRIO] FPGA Hardware Revision: 1.5.3
[cRIO] FPGA Software Revision: 1.5.3
[cRIO] * Loading StartupDlls: FRC_JavaVM
[cRIO]
[cRIO]
[cRIO] [OTA Server] Version: 2011 FRC, Jan 6 2011, 09:47:42
[cRIO]
[cRIO]
[cRIO] Welcome to LabVIEW Real-Time 8.6.1f3
[cRIO]
[cRIO] [Squawk VM] Version: 2011 FRC, Feb 18 2011, 15:57:21
[cRIO] [Squawk VM] File SQUAWK_DEBUG_ENABLED found, starting squawk in debug mode…
[cRIO] Listening for connection from proxy on serversocket://:2800
Failed to establish connection with VM: Connection timed out: connect - trying again in 5 seconds…
Trying to connect to VM on socket://10.35.2.2:2800
Established connection to VM (handshake took 16ms)
[cRIO] FPGA Hardware GUID: 0x2eaa5e59caf1a8a966853a011b61cc91
[cRIO] FPGA Software GUID: 0x2eaa5e59caf1a8a966853a011b61cc91
Waiting for connection from debugger on serversocket://:2900
Synchronizing debug state with VM…
Established connection to Debugger (handshake took 8813ms)

I do not know if this will solve your problem, but for me the cRIO will only outputs to the compiler or debugs if it has a static ip address. (Windows has a dynamic ip address by default) When using a dynamic ip address, our computers never get past the “Waiting for cRIO to reboot (##s)”

Info on setting up static ip address

You should set your ip address to: 10.XX.YY.ZZ
(XX.YY is team number [123 -> 01.23] ; change ZZ so that no two computers on the network share the same address)

we have been able to deploy code so that means our ip address should be set up correctly. also, as i mentioned i CAN run the debugger via an ethernet cable, just not wirelessly.

i was watching the java 101 kickoff workshop video recently (posted on the first website) and in the powerpoint presentation, the speaker mentioned that they were having problems getting the wireless debugger to work. maybe it’s an issue with first that’s not been solved yet??

I guess I wasn’t clear on what I was saying for what happens (at least for me) when using wireless: You can still deploy with a dynamic ip address, but you need a static ip address for println() and debugging.

I’m not sure what you are basing this claim on, but it’s not accurate. It is the case that for debugging you need to configure the IP address (regardless of how it is assigned) in the target connection to debug.

-Joe

As I said in my posts: from my own experience deploying/debugging.

Could you please explain this more completely? (Specifically how to do this without a static ip address)