Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you have an NXT brick, install the leJOS NXJ Plug-in. If you have an EV3 brick, install the leJOS EV3 plugin.

Image Added

Tip: To speed up the installation, uncheck the option "Contact all update sites during install to find required software". This will reduce the installation time from drastically (around 30 seconds instead 10 minutes).Image Removed


After the installation, the plugin requires a little configuration. Go to Window > Preferences > leJOS NXJ (Window > Preferences > leJOS EV3 respectively) and enter the base directory of your leJOS installation in the NXJ_HOME field.

...

  1. Choose File > New > Project > KIELER SCCharts > SCCharts Project
  2. In the project creation wizard that opens, select Mindstorms NXJ or Mindstorms EV3 (depending on your brick) as environment and hit finish
  3. The project wizard from the leJOS plugin opens. Set the project name to Flashlight and click finish.
  4. The project is created and the model file is opened in an editor (This might take a few seconds).

Edit the

...

Model:

Change the contents of the model file to the following code and save it.

...

The available wrapper code snippets are defined in the snippets directory of the project the directory assets/snippets in ftl files (FreeMarker template files). The table below gives an overview of the available wrapper code snippets.

...

Note: To view ftl files with highlighting, you may want to install the FreeMarker IDE feature from the JBoss Tools. However, this is not necessary to work with KIELER. JBoss Tools is available in the Eclipse Market Place and via update site. The update site for stable releases is http://download.jboss.org/jbosstools/neon/stable/updates/ . Note that only the FreeMarker IDE feature is required (Abridged JBoss Tools > FreeMarker IDE).

...

Build the

...

Project:

With the mouse over the SCT file in the project explorer, perform Right Click > Run As > KiCo Compilation.

A launch config is created, which compiles the model to Java code and creates wrapper code from the annotations in the model file. Afterwards this output is compiled and deployed to the Mindstorms brick, by using the launch shortcut from the leJOS plugin. If any errors occur, you can see them in the Console View.

For a deeper understanding of the project launch and initialization, take a look at the wiki page for PromThe model is now ready to be compiled. Compilation is done in the background when the project is built. There are two ways to build a project: manually using Project > Build Project, or automatically via Project > Build Automatically. If the automatic build is enabled, resources are built when they are saved.

Building the project will create a new folder kieler-gen in which all results are saved. This includes the compiled code from the model, an executable simulation for the model and wrapper code that is ready to be deployed to the Mindstorms Brick.

The simulation is saved as JAR file in kieler-gen/sim/bin and can be started via Right Click > Run as > KIELER Simulation. Models and variables of a running simulation are displayed in the Data Pool View.

Image Added

Besides the simulation, the finished wrapper code that can be uploaded to the Mindstorms brick is created as part of the project build. It is saved in kieler-gen/model. To upload it to the Mindstorms brick, use Right Click > Run as > leJOS NXT Program.

Image Added

Excluding the Simulation from the NXT Build

It is necessary to exclude the simulation directory and org.json directory inside kieler-gen from the NXT project specific build via Right Click > Build Path > Exclude. Afterwards the project has to be build again to remove all error markers in these directories.

Image Added

Normally the NXT project attempts to compile all Java files in the kieler-gen directory for the platform. However, the simulation that is generated is not targeted at the Mindstorms brick and has compilation errors. It is compiled separately by KIELER.

Available Wrapper Code Snippets

There are several wrapper code snippets that can be used as annotations on input and output variables in the model file. These snippets are inserted in the main file template as part of the project launchbuild. The available snippets are listed below.

...

IssueTypical Error MessagesDescriptionSolution
leJOS EV3 does not support Java 8

"java.lang.UnsupportedClassVersionError"

"unsupported major.minor version"

You compile the sources in your project with Java 8 and upload them to the brick. However the lejos EV3 does not support Java 8Go to the project properties and switch to Java 7 (Right Click on project > Properties > Java Compiler > Compiler compliance level)
Uploading to the brick does not respond
You compile a file successfully and when uploading the result, the connected brick is found. Anyway the upload does not terminate and does not react.Flash the brick with the current leJOS firmware. If the brick is recognized correctly and the attempt to upload a compiled file fails then the firmware on the brick might be outdated.
Compilation and uploading works from command line but not when using KIELER

This Java instance does not support a 32-bit JVM. Please install the desired version.

You can compile and upload code to the brick using the command line tools but when using KIELER an error message apprears because Java does not support 32-bit JVM.Set the LEJOS_NXT_JAVA_HOME environment variable, such that it points to an 32-bit JDK and is visible for GUI applications (or at least KIELER). The process to do so differs on every OS. As alternative, execute KIELER from terminal.
Brick does nothing after program finished and prints "Program exit"
A program was uploaded and finished without errors. Afterwards the brick prints "Program exit" but does not open the main menu.

This is normal behaviour if uploading a program in debug mode instead run mode (Debug As instead Run As in Eclipse). To get back to the main menu, press the ENTER and ESCAPE button of the brick at the same time.

...