PC GUI Tools
The NXJ Browser
leJOS NXJ includes a PC-based file browser for viewing and manipulating the files on the NXT.
It is started by the nxjbrowse script. If you are using an IDE, you can set NXJ Browse up as an external tool.
The NXJ Browser need the NXT it is connecting to, to be turned on and to be running the leJOS start-up menu. Although it should work while a user program is running, if the program starts the LCPBTResponder thread, this is not recommended.
The NXJ Browser first looks for a NXT connected by USB, and if it finds one shows just that in the selection window.
If it cannot find a USB-connected NXT, it does a Bluetooth inquiry to find any NXTs in range and shows them in the selection window. You then select the one you wish to connect to, and press connect.
After pressing Connect, the main browser screen is shown:
The NXJ browser shows you all the files on your NXT, together with their size in bytes and their location in the file system (start page, end page). See “Understanding the leJOS NXJ File System” to understand the meaning of the start and end pages.
The friendly name of the NXT you are connected to is shown in the title bar of the Windows – the name is “NXT” in this case.
From this screen, you can:
To delete files from the NXT, click the Delete tick boxes and press Delete Files. The next will make a chirping sound for each file deleted, and the NXJ Browser display will be updated. If the NXT is on the Files menu, its LCD will also be updated. An automatic defrag will occur when files are deleted, so there should be no gaps in the file system.
When you click Upload File, an Open file dialog box appears. Browse for the file you want to upload, select it, and click Open. NXJ Browse is not normally used for uploading program files as this is better done using the nxj or nxjupload tool or the leJOS Eclipse plugin. However, it is useful for uploading WAV files and data files for programs.
Files can be downloaded from the NXT to the PC by selecting the NXT file and pressing “Download”. This open a dialog that allows you to select the folder and filename to download the file to.
A program on the NXT can be run by selecting it and pressing “Run”. This shuts down NXJ Browser.
De-fragmenting the file system
The NXT file system cab be defragmented (removing any gaps between files) by pressing “Defrag”. In the latest versions of leJOS the file system does not normally need to be defragmented.
Setting the friendly name of the NXT
The Bluetooth friendly name of the NXT can be set by pressing “Set Name”, filling in the name (up to 16 characters) and pressing OK. Note that the Bluetooth power be on in order to set the friendly name, even if the connection to the NXT is by USB.
Remote Monitoring and Tracing
You can monitor a leJOS program over a Bluetooth connection while it is running by starting the LCPBTResponder thread and running the NXJ Monitor tool on the PC.
You an example of this, see the MonitorTest sample.
NXJ Monitor lets you see the values of sensors, and the values of motor tachometers, in near real-time, while your program executes.
It also lets you program displaying tracing messages to indicate what it is doing. These are displayed on the NXJ Monitor screen.
The program being monitored should include the following code in its start-up sequence:
On the PC, the NXJ Monitor tool should be run. NXJ Monitor lists the NXTs available over Bluetooth in the same way as the NXJ Browser tool, and lets you choose which one you wish to connect to.
When a connection has been made, the following window is displayed:
The Data Viewer displays the output from DataLogger. You can cut and paste the data into a spreadsheet for further analysis. It uses USB by default, but you can select Bluetooth if you wish. When you start the program, this window appears:
It connects to the NXT via USB by default, but if you click the Use BlueTooth button, it will.. For the fastest BlueTooth connection, enter the Bluetooth address. If you don’t know it, enter the NXT name. Otherwise, the program will take some time to search and complete the connection. By default, the program displays 2 data values per row, but you can enter any number you wish before starting to download. The DataLogger gives you the option to resending its data if you want to see it again (with a different row length for example). If you do, click the Start Download button again..
The Console viewer
The Console Viewer displays the output from RConsole, which is described in the section of Error Handling and Debugging. When you start the program, this window appears:
It connects to the NXT via USB by default, but if you click the Use BlueTooth button, it will. For the fastest BlueTooth connection, enter the Bluetooth address. If you don’t know it, enter the NXT name. Otherwise, the program will take some time to search and complete the connection.
The Connect button will initiate the connection with the NXT provided that the RConsole program is running on the NXT.
This is the GUI version of NXJFlash. It installs the firmware into the flash memory of your NXT. If your NXT has a recent version of the firmware already installed, it only needs to be turned on and connected to the PC with the USB cable. Otherwise, it needs to be put into firmware update mode by pressing the reset button for 4 seconds or more.
When the program opens, it looks like this:
When you click start you see this :
The next message is :
If you click Yes, the entire flash memory of the NXT will be cleared. If you click no and the installation fails, it might be because the the flash memory has been badly corrupted. In which case, try again and click Yes.
As the installation proceeds, the progress log will be
written. At the end, you have a chance to install firmware again.
NXT Charting Logger
The NXT Charting Logger is another data logging utility
that uses a well-defined columnar format (columns defined via the
lejos.util.LogColumn class) that [optionally] saves the data to a file.
Its main feature is that it uses JFreeChart to provide a dynamic X-Y
time series chart of the incoming data from the NXT. The chart can be
dynamically zoomed and panned [with optional domain skew] to examine
the plot in any level of detail you desire. The chart series can be
hidden, highlighted, and cloned into a fresh window to display subsets
of the data. All charts can be copied as .PNG format to be included
in other documents, reports, presentations, etc.
The NXT Charting Logger as it appears when logging data:
The utility works in conjunction with the lejos.util.NXTDataLogger class running on the NXT. NXT Charting Logger is launched by using the NXJChartingLogger shell script or .BAT file from the <LEJOS_HOME>\bin directory.
Use the Connect/Disconnect button (shown in the connected state above) to Connect/Disconnect to the NXT running NXTDataLogger.
You can specify a filename and folder/directory where you want the data logged saved to as tab-delimited data. You can leave this empty to just log to the Data Log tab without saving the data. This data can always be copied (select and CTRL+C) and pasted as well. If you select to log to an existing file, you will be asked to overwrite or append the data as shown in this image:
The dynamic chart control commands are:
The Chart Options Tab