Log in

View Full Version : how to print debugging statements to Netbeans


JacobGH
04-02-2012, 10:47
We're using Netbeans with Java to run our robot. If I upload new code to the robot then, as part of the compile/upload/reboot process a Netbeans is terminal is connected to the cRio, so any System.out.println() statements get printed to the development machine. But so far, I don't know how to get that terminal connection without the whole code-upload process. How do I do that?

RufflesRidge
04-02-2012, 10:52
Go to your Start menu and select NetConsole for cRIO on a machine connected to the robot network. The cRIO uses broadcast messages for the NetConsole so it should begin receiving the messages automatically. Note that you cannot use NetConsole and have the Netbeans console running at the same time on the same machine because they bind the same port. The can run at the same time on different machines and should both receive the messages.

ssirovica
04-02-2012, 12:17
You can also use this code to print to the dashboard on the Classmate or another PC. Here is an example:
public void printToClassmate(){

DriverStationLCD driverStation = DriverStationLCD.getInstance();
driverStation.println(DriverStationLCD.Line.kUser2 , 1, "Left Speed: " + Double.toString(leftEncoder.getRate()));
driverStation.println(DriverStationLCD.Line.kUser3 , 1, "Right Encoder: " + Double.toString(rightEncoder.getDistance()));
driverStation.println(DriverStationLCD.Line.kUser4 , 1, "Axis output: " + Double.toString(leftStick.getRawAxis(4)));
//driverStation.println(DriverStationLCD.Line.kUser5 , 1, "URF: " + Double.toString(ultra.getRangeInches()));
//driverStation.println(DriverStationLCD.Line.kUser4 , 1, "Gyro angle: " + Double.toString(gyro.getAngle()));

driverStation.updateLCD();
} Just make sure to change kUser after every line because that is the line number it prints on, and call this method in your main While loop.

JacobGH
04-02-2012, 15:43
I searched for "netconsole" on the classmate from the Windows start menu but it didn't find anything. I had one of the faulty USB classmate images, so I had to install the driver station and cRio images from a download and maybe I didn't get the netconsole that way?

As for using the diverStationLCD, ssirovica, I need the ability to print out lots information linearly, far more than the 6 or so lines I get out of the driver station.

Is there some way I can just manually connect a terminal to the stdout on the cRio to get those messages? The development machine runs Ubuntu Linux, so it has a powerful terminal.

RufflesRidge
04-02-2012, 16:04
I believe NetConsole is installed with the Utilities Update, but I don't remember for sure. I know someone has posted a cross platform Python version somewhere here on CD that will listen on the right UDP port and print whatever it hears, but I don't have time to dig it up right now.

JacobGH
04-02-2012, 16:06
Okay, I'll go search for that cross-platform UDP listener because that would be great. Thanks.

cgmv123
04-02-2012, 18:58
Type http://10.te.am.2 into a web browser on a computer that is configured for the same network as the cRIO, where te.am is the usual team number IP.

The button with the monitor (see below) on it on the left side is the cRIO terminal window. You have to check "refresh repeatedly" on the bottom for real time.

http://zone.ni.com/images/reference/en-XX/help/371361G-01/noloc_env_wif_console.gif