<
From version < 20.1 >
edited by aas2
on 2015/11/17 14:28
To version < 35.1 >
edited by aas2
on 2016/08/01 12:52
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -8,28 +8,46 @@
8 8  
9 9  == Overview ==
10 10  
11 -Mindstorms is a product family from Lego, with sensors, motors and a programmable brick. The newest iteration of the product family is the EV3 programmable brick. Its predecessors are NXT and RCX. In the following we will see how to develop applications for the NXT brick, thus //Mindstorms// will be used exchangeable with //NXT brick//.
11 +Mindstorms is a product family from Lego, with sensors, motors and a programmable brick. The newest iteration of the product family is the EV3 programmable brick. Its predecessors are NXT and RCX. In the following we will see how to develop applications for the NXT brick.
12 12  
13 13  Several open-source, third-party replacements for the offical Lego firmware have been developed. These support many well known programming languages, such as Java, C/C++, Python, Lua, etc. In the following we will use KIELER SCCharts to program Mindstorms running the Lego Java Operating System ([[leJOS>>url:http://www.lejos.org/||shape="rect"]]). Therefore we will first install leJOS NXJ and flash its firmware. Afterwards we will create a simple SCCharts project in KIELER that we will compile and deploy to the NXT brick.
14 14  
15 +If you want to learn the SCCharts langugage first, you can follow these links:
16 +
17 +* [[Introduction to SCCharts>>doc:SCCharts]]
18 +* [[The Textual SCCharts Language SCT>>doc:Textual SCCharts Language SCT]]
19 +* [[SCCharts Examples>>doc:Examples]]
20 +
15 15  ----
16 16  
17 17  == Download and install leJOS ==
18 18  
19 -Download and extract the newest archives for your Operating System from [[Sourceforce>>url:http://sourceforge.net/projects/nxt.lejos.p/files/||shape="rect"]].
25 +Download and extract the newest archives for your Operating System from [[Sourceforce>>url:http://sourceforge.net/projects/nxt.lejos.p/files/||shape="rect"]] (Linux/Mac) or use the Setup.exe (Windows).
20 20  
21 21  The further installation is explained in detail at [[http:~~/~~/www.lejos.org/nxt/nxj/tutorial/Preliminaries/GettingStarted.htm>>url:http://www.lejos.org/nxt/nxj/tutorial/Preliminaries/GettingStarted.htm||shape="rect"]].
22 22  
29 +Do not forget to flash the download leJOS firmware to the Mindstorms brick as explained in the tutorial!
30 +
23 23  === Known issues ===
24 24  
25 -== Linux ==
33 +==== Linux ====
26 26  
27 27  On Linux there is an issue when uploading the firmware because of a kernel module ([[http:~~/~~/ubuntuforums.org/showthread.php?t=1123633>>url:http://ubuntuforums.org/showthread.php?t=1123633||shape="rect"]]). If you can't upload the firmware with your Linux OS, add **blacklist cdc_acm**{{code language="none"}}{{/code}} at the very end of the file **{{code language="none"}}/etc/modprobe.d/blacklist.conf{{/code}}**. Afterwards execute **{{code language="none"}}sudo rmmod cdc_acm{{/code}}**. This will remove the cdc_acm module from the kernel and prevent its restart. Now try to flash the firmware again.
28 28  
29 29  Another issue is that the development package of **libusb** has to be installed. On Ubuntu you can do this by using **{{code language="none"}}sudo apt-get install libusb-dev{{/code}}**.
30 30  
31 -Furthermore, to use USB connection, a java library has to be compiled via ant. To do this perform **cd /path/to/leJOS/build** and start ant. If the ant build tool is not installed on your system, you can do so via **sudo apt-get install ant**.
39 +Furthermore, to use USB connection, a java library has to be compiled via **ant**. To do this perform **cd /path/to/leJOS/build** and start **ant**. If the ant build tool is not installed on your system, you can do so via **sudo apt-get install ant**.
32 32  
41 +==== Windows ====
42 +
43 +The setup.exe of the current LEGO Fantom driver for Windows (1.2.0) has an awkward issue. If you get an error message (Developer Error) because an .msi file could not be found, don't panic. The file is part of the downladed archive (in the Products folder) but you have to start it manually.
44 +
45 +==== Mac OS X ====
46 +
47 +The **leJOS NXJ** tools require a **32 Bit** version of Java. However, newer 32 Bit versions of Java are not longer available for Mac. Thus to use leJOS the installation of **Java 1.6 is required**, which is the last one that supports a 32 Bit mode. You can download the installer for Java 1.6 from [[https:~~/~~/support.apple.com/kb/dl1572?locale=en_US>>url:https://support.apple.com/kb/dl1572?locale=en_US||shape="rect"]]. It will install Java 1.6 to ///System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home// so that the environment variable //LEJOS_NXT_JAVA_HOME//, which is set in the installation instructions, points to the correct path.
48 +
49 +The environment variable LEJOS_NXT_JAVA_HOME is set in the installation tutorial by editing ~~/.profile. However, on a Mac the environment variables defined in this file are not visible for GUI Applications, only for apps started from terminal. Thus to use leJOS together with KIELER, one either has to start KIELER from terminal or set the environment variable so that all GUI applications can access it. However, this does not seem to be trivial on Mac (see also [[http:~~/~~/stackoverflow.com/questions/135688/setting-environment-variables-in-os-x>>url:http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x||shape="rect"]]).
50 +
33 33  ----
34 34  
35 35  == Test the Mindstorm ==
... ... @@ -36,42 +36,45 @@
36 36  
37 37  A simple Hello World application for the Mindstorms is developed as part of the leJOS tutorial [[http:~~/~~/www.lejos.org/nxt/nxj/tutorial/Preliminaries/FirstProgram.htm>>url:http://www.lejos.org/nxt/nxj/tutorial/Preliminaries/FirstProgram.htm||shape="rect"]]
38 38  
39 -If this works with your device, you are able to start using KIELER to develop applications for the NXT brick.\\
57 +If this works with your device, you are able to start using KIELER to develop applications for the NXT brick.
40 40  
41 41  ----
42 42  
43 -== The Eclipse plugin for leJOS ==
61 +== Download and Configure KIELER
62 + ==
44 44  
45 -There is an Eclipse plugin for leJOS which adds a project creation wizard and launch configuration to the platform. You can install it via the Eclipse Marketplace (//Help > Eclipse Marketplace...//). If you have an **NXT** **brick**, install the **leJOS NXJ** Plug-in.
64 +Download and unpack the nightly build of KIELER for your OS. It is available at the [[doc:Downloads]] page.\\
46 46  
47 -[[image:attach:lejos_eclipse_plugin.png]]
66 +**Note:** Java 1.8 is needed on all operating systems. With Java 1.7 not all plugins of KIELER will be loaded. **Furthermore on Windows**, you will need to download the **32 Bit version of KIELER** – even if you have a 64 bit operating system! Otherwise flashing the brick and uploading to the brick will fail.
48 48  
49 -After the installation, the plugin requires a little configuration. Go to //Window > Preferences > leJOS NXJ //and enter the base directory of your **leJOS** **installation** in the **NXJ_HOME field**.
68 +=== The Eclipse plugin for leJOS ===
50 50  
51 -----
70 +There is an Eclipse plugin for leJOS which adds a project creation wizard and launch configuration to the platform.
52 52  
53 -== Configure KIELER ==
72 +1. You have to install it via the Eclipse Marketplace (//Help > Eclipse Marketplace...//).
73 +OR
74 +1. Install the plugin manually (Help > Install new Software...). Use the following update site\\
75 +11. for NXT: [[http:~~/~~/www.lejos.org/tools/eclipse/plugin/nxj/>>url:http://www.lejos.org/tools/eclipse/plugin/nxj/||shape="rect"]]
76 +11. for EV3: [[http:~~/~~/www.lejos.org/tools/eclipse/plugin/ev3/>>url:http://www.lejos.org/tools/eclipse/plugin/ev3/||shape="rect"]]
54 54  
55 -With the Eclipse plugin for leJOS installed, you can now use KIELER SCCharts for an model-based approach of programming.
78 +If you have an **NXT** **brick**, install the **leJOS NXJ** Plug-in. If you have an **EV3 brick**, install the **leJOS EV3** plugin.
56 56  
57 -First check the environment settings for NXJ of the KIELER tool (//Window > Preferences > KIELER > Environments//). On the **Execute** tab, ensure that only the commands for your operating system are checked.
80 +[[image:attach:lejos_eclipse_plugin.png]]
58 58  
59 -Hit the //Variables// button and search for **nxj.home**. If the variable exists, your good. If it does not exist, ensure that you installed and configured the Ecplise plugin for leJOS NXJ correctly.
82 +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**.
60 60  
61 -[[image:attach:environments_preferences.png]]
84 +For EV3, the plugin requires the IP address to connect to the brick (it may work without, but its safer to directly set the name. Reduces headache ). Check **Connect to named brick** and enter the **IP adress** of the brick (displayed on the brick at startup).
62 62  
63 -**Note:** If you already created and launched a project, the settings of the environment are copied to the launch configuration. It thus may be necessary to alter settings on the launch configuration as well as the environment.
64 -
65 65  ----
66 66  
67 67  == Creating an Example Project ==
68 68  
69 -The following shows how to create a project, that will turn on a light if a button is pressed.
90 +The following shows how to create a project, which will turn on a light if a button is pressed.
70 70  
71 71  === Create a new project: ===
72 72  
73 73  1. Choose //File > New > Project > KIELER SCCharts > SCCharts Project//
74 -1. In the project creation wizard that opens, select //Mindstorms NXJ// as environment and hit //finish//
95 +1. In the project creation wizard that opens, select //Mindstorms NXJ// or// Mindstorms EV3// (depending on your brick) as environment and hit //finish//
75 75  1. The project wizard from the leJOS plugin opens. Set the project name to //Flashlight// and click //finish//.
76 76  1. The project is created and the model file is opened in an editor (This might take a few seconds).
77 77  
... ... @@ -79,7 +79,7 @@
79 79  
80 80  Change the contents of the model file to the following code and save it.
81 81  
82 -{{code title="Floodlight.sct" theme="Eclipse" language="sct"}}
103 +{{code language="sct" theme="Eclipse" title="Floodlight.sct"}}
83 83  scchart Flashlight {
84 84  
85 85   @Wrapper TouchSensor, S4
... ... @@ -98,7 +98,13 @@
98 98  
99 99  This model will start in the state lightOff. If the button is pressed, it will turn on the light and change to the corresponding state, where the light is turned off, as soon as the button is not pressed anymore.
100 100  
101 -The annotations on the input and output variable are used to define which wrapper code is used to set / read them. **@Wrapper TouchSensor, S4** will set the input variable to true iff the touch sensor on the port S4 is pressed. **@Wrapper Floodlight, S1** on the output variable will turn on the red led of the light sensor that is attatched to port S1 iff the variable is true.**
122 +The annotations on the input and output variable are used to define which wrapper code is used to set / read them. **@Wrapper TouchSensor, S4** will set the input variable to true iff the touch sensor on the port S4 is pressed. **@Wrapper Floodlight, S1** on the output variable will turn on the red led of the light sensor that is attatched to port S1 iff the variable is true.
123 +
124 +The available wrapper code snippets are defined in the //snippets// directory of the project in ftl files (FreeMarker template files). The table below gives an overview of the available wrapper code snippets.
125 +
126 +**Note:** The Floodlight of the EV3 has a pretty high latency when switching between on and off.
127 +
128 +**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 Eclipse Luna is [[http:~~/~~/download.jboss.org/jbosstools/updates/stable/luna/>>url:http://download.jboss.org/jbosstools/updates/stable/luna/||shape="rect"]] . Note that only the //FreeMarker IDE// feature is required (Abridged JBoss Tools > FreeMarker IDE).**
102 102  **
103 103  
104 104  === Launch the project: ===
... ... @@ -105,16 +105,552 @@
105 105  
106 106  With the mouse over the SCT file in the project explorer, perform //Right Click > Run As > KiCo Compilation.//
107 107  
108 -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 shell commands that are defined in the Mindstorms NXJ environment.
135 +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.
109 109  
110 110  For a deeper understanding of the project launch and initialization, take a look at the [[wiki page for Prom>>url:http://rtsys.informatik.uni-kiel.de/confluence/pages/viewpage.action?pageId=13762626||shape="rect"]].
111 111  
139 +=== Available Wrapper Code Snippets ===
140 +
141 +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 launch. The available snippets are listed below.
142 +
143 +For sensors, the port has to be on of S1, S2, S3, S4.
144 +
145 +For motors / actuators the port has to be one of A, B, C, D.
146 +
147 +(% class="wrapped" %)
148 +|=(((
149 +Snippet Name and Parameters
150 +)))|=(((
151 +Description
152 +)))|=(((
153 +Use on
154 +)))|=(% colspan="1" %)(% colspan="1" %)
155 +(((
156 +Variable type
157 +)))|=(((
158 +Remark
159 +)))|=(% colspan="1" %)(% colspan="1" %)
160 +(((
161 +Defined in File
162 +)))
163 +|(% colspan="1" %)(% colspan="1" %)
164 +(((
165 +**Clock,** milliseconds
166 +)))|(% colspan="1" %)(% colspan="1" %)
167 +(((
168 +Sets a variable to true if the time in milliseconds passed
169 +)))|(% colspan="1" %)(% colspan="1" %)
170 +(((
171 +input
172 +)))|(% colspan="1" %)(% colspan="1" %)
173 +(((
174 +bool
175 +)))|(% colspan="1" %)(% colspan="1" %)
176 +(((
177 +See also ResetClock.
178 +)))|(% colspan="1" %)(% colspan="1" %)
179 +(((
180 +timing.ftl
181 +)))
182 +|(% colspan="1" %)(% colspan="1" %)
183 +(((
184 +**ResetClock,** clockVariableName, autoFalse
185 +)))|(% colspan="1" %)(% colspan="1" %)
186 +(((
187 +Resets a clock, such that the full time intervall of the clock has to elapse, before the clock will be set to true again.
188 +
189 +If autoFalse is true, the reset variable will be set to false automatically.
190 +)))|(% colspan="1" %)(% colspan="1" %)
191 +(((
192 +output
193 +)))|(% colspan="1" %)(% colspan="1" %)
194 +(((
195 +bool
196 +)))|(% colspan="1" %)(% colspan="1" %)
197 +(((
198 +autoFalse is true per default.
199 +)))|(% colspan="1" %)(% colspan="1" %)
200 +(((
201 +timing.ftl
202 +)))
203 +|(% colspan="1" %)(% colspan="1" %)
204 +(((
205 +**Time**
206 +)))|(% colspan="1" %)(% colspan="1" %)
207 +(((
208 +Reads the elapsed time since program start
209 +)))|(% colspan="1" %)(% colspan="1" %)
210 +(((
211 +input
212 +)))|(% colspan="1" %)(% colspan="1" %)
213 +(((
214 +int
215 +)))|(% colspan="1" %)(% colspan="1" %)
216 +(((
217 +
218 +)))|(% colspan="1" %)(% colspan="1" %)
219 +(((
220 +timing.ftl
221 +)))
222 +|(% colspan="1" %)(% colspan="1" %)
223 +(((
224 +**TickDuration,** targetInMilliseconds
225 +)))|(% colspan="1" %)(% colspan="1" %)
226 +(((
227 +Delays the execution until the tick loop takes at least as long as the given target duration.
228 +
229 +The input variable is set to the actual tick loop duration.
230 +)))|(% colspan="1" %)(% colspan="1" %)
231 +(((
232 +input
233 +)))|(% colspan="1" %)(% colspan="1" %)
234 +(((
235 +int
236 +)))|(% colspan="1" %)(% colspan="1" %)
237 +(((
238 +Should be used on the very first input variable in the model, such that waiting is the last action in the tick loop.
239 +)))|(% colspan="1" %)(% colspan="1" %)
240 +(((
241 +timing.ftl
242 +)))
243 +|(% colspan="1" %)(% colspan="1" %)
244 +(((
245 +**Sleep**
246 +)))|(% colspan="1" %)(% colspan="1" %)
247 +(((
248 +Lets the current thread sleep the time in milliseconds of the variable value.
249 +)))|(% colspan="1" %)(% colspan="1" %)
250 +(((
251 +output
252 +)))|(% colspan="1" %)(% colspan="1" %)
253 +(((
254 +int
255 +)))|(% colspan="1" %)(% colspan="1" %)
256 +(((
257 +
258 +)))|(% colspan="1" %)(% colspan="1" %)
259 +(((
260 +timing.ftl
261 +)))
262 +|(% colspan="1" %)(% colspan="1" %)
263 +(((
264 +**Print,** autoReset
265 +)))|(% colspan="1" %)(% colspan="1" %)
266 +(((
267 +Prints a string variable if the string is not empty. If autoReset is true then the string variable is set to the empty string after it has been printed
268 +)))|(% colspan="1" %)(% colspan="1" %)
269 +(((
270 +output
271 +)))|(% colspan="1" %)(% colspan="1" %)
272 +(((
273 +string
274 +)))|(% colspan="1" %)(% colspan="1" %)
275 +(((
276 +autoReset is true per default.
277 +)))|(% colspan="1" %)(% colspan="1" %)
278 +(((
279 +print.ftl
280 +)))
281 +|(% colspan="1" %)(% colspan="1" %)
282 +(((
283 +**DrawString,** x, y
284 +)))|(% colspan="1" %)(% colspan="1" %)
285 +(((
286 +Prints a string to the given x and y coordinate on the LCD.
287 +)))|(% colspan="1" %)(% colspan="1" %)
288 +(((
289 +output
290 +)))|(% colspan="1" %)(% colspan="1" %)
291 +(((
292 +string
293 +)))|(% colspan="1" %)(% colspan="1" %)
294 +(((
295 +
296 +)))|(% colspan="1" %)(% colspan="1" %)
297 +(((
298 +print.ftl
299 +)))
300 +|(% colspan="1" %)(% colspan="1" %)
301 +(((
302 +**Button, **buttonId
303 +)))|(% colspan="1" %)(% colspan="1" %)
304 +(((
305 +Sets a variable to true iff the button on the Mindstorms device is pressed.
306 +)))|(% colspan="1" %)(% colspan="1" %)
307 +(((
308 +input
309 +)))|(% colspan="1" %)(% colspan="1" %)
310 +(((
311 +bool
312 +)))|(% colspan="1" %)(% colspan="1" %)
313 +(((
314 +The buttonId has to be one of ENTER, LEFT, RIGHT
315 +)))|(% colspan="1" %)(% colspan="1" %)
316 +(((
317 +touch_and_buttons.ftl
318 +)))
319 +|(% colspan="1" %)(% colspan="1" %)
320 +(((
321 +**TouchSensor**, port
322 +)))|(% colspan="1" %)(% colspan="1" %)
323 +(((
324 +Sets a variable to true iff the touch sensor on the given port is pressed.
325 +)))|(% colspan="1" %)(% colspan="1" %)
326 +(((
327 +input
328 +)))|(% colspan="1" %)(% colspan="1" %)
329 +(((
330 +bool
331 +)))|(% colspan="1" %)(% colspan="1" %)
332 +(((
333 +
334 +)))|(% colspan="1" %)(% colspan="1" %)
335 +(((
336 +touch_and_buttons.ftl
337 +)))
338 +|(% colspan="1" %)(% colspan="1" %)
339 +(((
340 +**LightSensor,** port, percentValue
341 +)))|(% colspan="1" %)(% colspan="1" %)
342 +(((
343 +Reads  the value of a light sensor.
344 +
345 +If percentValue is true, the a percent value is retured, based on the light sensor calibration.
346 +)))|(% colspan="1" %)(% colspan="1" %)
347 +(((
348 +input
349 +)))|(% colspan="1" %)(% colspan="1" %)
350 +(((
351 +int
352 +)))|(% colspan="1" %)(% colspan="1" %)
353 +(((
354 +percentValue is not available on EV3
355 +)))|(% colspan="1" %)(% colspan="1" %)
356 +(((
357 +light.ftl
358 +)))
359 +|(% colspan="1" %)(% colspan="1" %)
360 +(((
361 +**CalibrateLightSensor,** port, signal
362 +)))|(% colspan="1" %)(% colspan="1" %)
363 +(((
364 +Calibrates a light sensors high or low values. This means if the variable is true, the current value of the light sensor is taken as its reference high / low value.
365 +)))|(% colspan="1" %)(% colspan="1" %)
366 +(((
367 +output
368 +)))|(% colspan="1" %)(% colspan="1" %)
369 +(((
370 +bool
371 +)))|(% colspan="1" %)(% colspan="1" %)
372 +(((
373 +signal has to be one of High, Low
374 +)))|(% colspan="1" %)(% colspan="1" %)
375 +(((
376 +light.ftl
377 +)))
378 +|(% colspan="1" %)(% colspan="1" %)
379 +(((
380 +**Floodlight,** port
381 +)))|(% colspan="1" %)(% colspan="1" %)
382 +(((
383 +Reads / Sets the state of the red lamp of the light sensor.
384 +)))|(% colspan="1" %)(% colspan="1" %)
385 +(((
386 +input
387 +
388 +output
389 +)))|(% colspan="1" %)(% colspan="1" %)
390 +(((
391 +bool
392 +)))|(% colspan="1" %)(% colspan="1" %)
393 +(((
394 +
395 +)))|(% colspan="1" %)(% colspan="1" %)
396 +(((
397 +light.ftl
398 +)))
399 +|(% colspan="1" %)(% colspan="1" %)
400 +(((
401 +**RCXLamp,** port
402 +)))|(% colspan="1" %)(% colspan="1" %)
403 +(((
404 +Turns an RCX lamp on (variable is true) or off (variable is false)
405 +)))|(% colspan="1" %)(% colspan="1" %)
406 +(((
407 +output
408 +)))|(% colspan="1" %)(% colspan="1" %)
409 +(((
410 +bool
411 +)))|(% colspan="1" %)(% colspan="1" %)
412 +(((
413 +
414 +)))|(% colspan="1" %)(% colspan="1" %)
415 +(((
416 +light.ftl
417 +)))
418 +|(% colspan="1" %)(% colspan="1" %)
419 +(((
420 +**MotorSpeed,** port, brake
421 +)))|(% colspan="1" %)(% colspan="1" %)
422 +(((
423 +Reads / Sets the speed of the motor in degrees per minute. If the speed value is negative, the motor will drive backwards. If the speed is zero, the motor will actively brake until it stops (brake is true) or remove all power and rollout (brake is false).
424 +)))|(% colspan="1" %)(% colspan="1" %)
425 +(((
426 +input
427 +
428 +output
429 +)))|(% colspan="1" %)(% colspan="1" %)
430 +(((
431 +int
432 +)))|(% colspan="1" %)(% colspan="1" %)
433 +(((
434 +brake is true per default.
435 +)))|(% colspan="1" %)(% colspan="1" %)
436 +(((
437 +motor.ftl
438 +)))
439 +|(% colspan="1" %)(% colspan="1" %)
440 +(((
441 +**MotorIsMoving,** port
442 +)))|(% colspan="1" %)(% colspan="1" %)
443 +(((
444 +Sets a variable to true iff the motor on the given port is moving.
445 +)))|(% colspan="1" %)(% colspan="1" %)
446 +(((
447 +input
448 +)))|(% colspan="1" %)(% colspan="1" %)
449 +(((
450 +bool
451 +)))|(% colspan="1" %)(% colspan="1" %)
452 +(((
453 +
454 +)))|(% colspan="1" %)(% colspan="1" %)
455 +(((
456 +motor.ftl
457 +)))
458 +|(% colspan="1" %)(% colspan="1" %)
459 +(((
460 +**MotorRotation,** port
461 +)))|(% colspan="1" %)(% colspan="1" %)
462 +(((
463 +Lets a motor rotate the variable value in degrees. This is only done if the value is unequal zero. If the value is negative, the motor rotates backwards. The variable is set to zero afterwards, such that setting the variable once to a value //X//, will let the motor rotate //X// degrees.
464 +)))|(% colspan="1" %)(% colspan="1" %)
465 +(((
466 +output
467 +)))|(% colspan="1" %)(% colspan="1" %)
468 +(((
469 +int
470 +)))|(% colspan="1" %)(% colspan="1" %)
471 +(((
472 +
473 +)))|(% colspan="1" %)(% colspan="1" %)
474 +(((
475 +motor.ftl
476 +)))
477 +|(% colspan="1" %)(% colspan="1" %)
478 +(((
479 +**Beep,** volume
480 +)))|(% colspan="1" %)(% colspan="1" %)
481 +(((
482 +Plays a beep sound as long as the variable is true.
483 +)))|(% colspan="1" %)(% colspan="1" %)
484 +(((
485 +output
486 +)))|(% colspan="1" %)(% colspan="1" %)
487 +(((
488 +bool
489 +)))|(% colspan="1" %)(% colspan="1" %)
490 +(((
491 +default volume is 10
492 +)))|(% colspan="1" %)(% colspan="1" %)
493 +(((
494 +sound.ftl
495 +)))
496 +|(% colspan="1" %)(% colspan="1" %)
497 +(((
498 +**Buzz,** volume
499 +)))|(% colspan="1" %)(% colspan="1" %)
500 +(((
501 +Plays a buzz sound as long as the variable is true.
502 +)))|(% colspan="1" %)(% colspan="1" %)
503 +(((
504 +output
505 +)))|(% colspan="1" %)(% colspan="1" %)
506 +(((
507 +bool
508 +)))|(% colspan="1" %)(% colspan="1" %)
509 +(((
510 +default volume is 10
511 +)))|(% colspan="1" %)(% colspan="1" %)
512 +(((
513 +sound.ftl
514 +)))
515 +|(% colspan="1" %)(% colspan="1" %)
516 +(((
517 +**BeepSequence,** direction, volume
518 +)))|(% colspan="1" %)(% colspan="1" %)
519 +(((
520 +Plays a sequence of tones in either ascending or descending tone frequency if the variable is true.
521 +
522 +The variable is set to false automatically.
523 +)))|(% colspan="1" %)(% colspan="1" %)
524 +(((
525 +output
526 +)))|(% colspan="1" %)(% colspan="1" %)
527 +(((
528 +bool
529 +)))|(% colspan="1" %)(% colspan="1" %)
530 +(((
531 +direction has to be one of Up, Down
532 +
533 +default volume is 10
534 +)))|(% colspan="1" %)(% colspan="1" %)
535 +(((
536 +sound.ftl
537 +)))
538 +|(% colspan="1" %)(% colspan="1" %)
539 +(((
540 +**UltrasonicSensor,** port
541 +)))|(% colspan="1" %)(% colspan="1" %)
542 +(((
543 +Reads the distance that an ultrasonic sensor measures.
544 +)))|(% colspan="1" %)(% colspan="1" %)
545 +(((
546 +input
547 +)))|(% colspan="1" %)(% colspan="1" %)
548 +(((
549 +int
550 +)))|(% colspan="1" %)(% colspan="1" %)
551 +(((
552 +
553 +)))|(% colspan="1" %)(% colspan="1" %)
554 +(((
555 +ultrasonic.ftl
556 +)))
557 +|(% colspan="1" %)(% colspan="1" %)
558 +(((
559 +**Gyro,** port, mode
560 +)))|(% colspan="1" %)(% colspan="1" %)
561 +(((
562 +Reads the value of a gyroscope.
563 +)))|(% colspan="1" %)(% colspan="1" %)
564 +(((
565 +input
566 +)))|(% colspan="1" %)(% colspan="1" %)
567 +(((
568 +int
569 +)))|(% colspan="1" %)(% colspan="1" %)
570 +(((
571 +Not available on NXT
572 +
573 +mode hat to be one of Angle, Rate
574 +)))|(% colspan="1" %)(% colspan="1" %)
575 +(((
576 +gyro.ftl
577 +)))
578 +|(% colspan="1" %)(% colspan="1" %)
579 +(((
580 +**CalibrateGyro,** port, autoReset
581 +)))|(% colspan="1" %)(% colspan="1" %)
582 +(((
583 +Resets a gyroscope if the variable is true.
584 +
585 +If autoReset is true, the variable is set to false automatically.
586 +)))|(% colspan="1" %)(% colspan="1" %)
587 +(((
588 +output
589 +)))|(% colspan="1" %)(% colspan="1" %)
590 +(((
591 +bool
592 +)))|(% colspan="1" %)(% colspan="1" %)
593 +(((
594 +autoReset is true per default
595 +)))|(% colspan="1" %)(% colspan="1" %)
596 +(((
597 +gyro.ftl
598 +)))
599 +
600 +
601 +
112 112  ----
113 113  
114 114  == Using the Remote Console (RConsole) ==
115 115  
116 -The display of the NXT brick is rather small compared to a Monitor. To ease debugging, one can print to a Remote Console (RConsole), if the USB cable is connected. This enables easier collection for example of sensor data.
606 +The display of the **NXT brick** is rather small compared to a Monitor. To ease debugging, one can print to a Remote Console (RConsole), if the USB cable is connected. This enables easier collection for example of sensor data.
117 117  
118 -To use the RConsole, **uncomment** the **RConsole** lines in the wrapper code template **Main.ftl**. Start the **nxjconsoleviewer** tool in the bin directory of your **leJOS installation**.
608 +To use the RConsole, **uncomment** the **RConsole** lines in the wrapper code template **Main.ftl**. Start the **nxjconsoleviewer** tool in the bin directory of your **leJOS installation**. Now, when **starting the application**, the brick tries to connect with the nxjconsoleviewer. **Press the //Connect//** button. If connected succesfully, RConsole.println(...) commands will be written to this window.
119 119  
120 -Now, when **starting the application**, the brick tries to connect with the nxjconsoleviewer. **Press the //Connect//** button. If connected succesfully, RConsole.println(...) commands will be written to this window.
610 +The **EV3 brick** has a similar feature. However it does not require any code changes. Just run the ev3console program in the bin directory of your leJOS installation from command line. The output of the brick will be printed to this command line.
611 +
612 +----
613 +
614 +== Problem Solving ==
615 +
616 +The following presents typical issues and how to solve them.
617 +
618 +(% class="wrapped" %)
619 +|=(((
620 +Issue
621 +)))|=(((
622 +Typical Error Messages
623 +)))|=(((
624 +Description
625 +)))|=(((
626 +Solution
627 +)))
628 +|(((
629 +leJOS EV3 does not support Java 8
630 +)))|(((
631 +"java.lang.UnsupportedClassVersionError"
632 +
633 +"unsupported major.minor version"
634 +)))|(((
635 +You compile the sources in your project with Java 8 and upload them to the brick. However the lejos EV3 does not support Java 8
636 +)))|(((
637 +Go to the project properties and switch to Java 7 (Right Click on project > Properties > Java Compiler > Compiler compliance level)
638 +)))
639 +|(% colspan="1" %)(% colspan="1" %)
640 +(((
641 +Uploading to the brick does not respond
642 +)))|(% colspan="1" %)(% colspan="1" %)
643 +(((
644 +
645 +)))|(% colspan="1" %)(% colspan="1" %)
646 +(((
647 +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.
648 +)))|(% colspan="1" %)(% colspan="1" %)
649 +(((
650 +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.
651 +)))
652 +|(% colspan="1" %)(% colspan="1" %)
653 +(((
654 +Compilation and uploading works from command line but not when using KIELER
655 +)))|(% colspan="1" %)(% colspan="1" %)
656 +(((
657 +This Java instance does not support a 32-bit JVM. Please install the desired version.
658 +)))|(% colspan="1" %)(% colspan="1" %)
659 +(((
660 +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.
661 +)))|(% colspan="1" %)(% colspan="1" %)
662 +(((
663 +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.
664 +)))
665 +|(% colspan="1" %)(% colspan="1" %)
666 +(((
667 +Brick does nothing after program finished and prints "Program exit"
668 +)))|(% colspan="1" %)(% colspan="1" %)
669 +(((
670 +
671 +)))|(% colspan="1" %)(% colspan="1" %)
672 +(((
673 +A program was uploaded and finished without errors. Afterwards the brick prints "Program exit" but does not open the main menu.
674 +)))|(% colspan="1" %)(% colspan="1" %)
675 +(((
676 +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.
677 +)))
678 +
679 +
680 +
681 +
682 +
683 +input
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -14516260
1 +20153911
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/14516260/LEGO Mindstorms with leJOS and SCCharts
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/20153911/LEGO Mindstorms with leJOS and SCCharts