<
From version < 35.1 >
edited by aas2
on 2016/08/01 12:52
To version < 41.1 >
edited by aas2
on 2018/01/15 13:08
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -77,8 +77,12 @@
77 77  
78 78  If you have an **NXT** **brick**, install the **leJOS NXJ** Plug-in. If you have an **EV3 brick**, install the **leJOS EV3** plugin.
79 79  
80 -[[image:attach:lejos_eclipse_plugin.png]]
80 +[[image:attach:Screenshot_20171016_130805.png]]
81 81  
82 +**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).
83 +
84 +\\
85 +
82 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**.
83 83  
84 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).
... ... @@ -96,7 +96,7 @@
96 96  1. The project wizard from the leJOS plugin opens. Set the project name to //Flashlight// and click //finish//.
97 97  1. The project is created and the model file is opened in an editor (This might take a few seconds).
98 98  
99 -=== Edit the model: ===
103 +=== Edit the Model: ===
100 100  
101 101  Change the contents of the model file to the following code and save it.
102 102  
... ... @@ -121,24 +121,38 @@
121 121  
122 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 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.
128 +The available wrapper code snippets are defined in the directory //assets/snippets// in ftl files (FreeMarker template files). The table below gives an overview of the available wrapper code snippets.
125 125  
126 126  **Note:** The Floodlight of the EV3 has a pretty high latency when switching between on and off.
127 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).**
132 +**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/ >>url:http://download.jboss.org/jbosstools/neon/stable/updates/||shape="rect"]]. Note that only the //FreeMarker IDE// feature is required (Abridged JBoss Tools > FreeMarker IDE).**
129 129  **
130 130  
131 -=== Launch the project: ===
135 +=== Build the Project: ===
132 132  
133 -With the mouse over the SCT file in the project explorer, perform //Right Click > Run As > KiCo Compilation.//
137 +The 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.
134 134  
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.
139 +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.
136 136  
137 -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"]].
141 +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.
138 138  
143 +[[image:attach:Screenshot_20171016_110005.png]]
144 +
145 +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//.
146 +
147 +[[image:attach:Screenshot_20171016_120554.png]]
148 +
149 +==== Excluding the Simulation from the NXT Build ====
150 +
151 +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.
152 +
153 +[[image:attach:Screenshot_20171016_105821.png]]
154 +
155 +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.
156 +
139 139  === Available Wrapper Code Snippets ===
140 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.
159 +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 build. The available snippets are listed below.
142 142  
143 143  For sensors, the port has to be on of S1, S2, S3, S4.
144 144  
... ... @@ -165,7 +165,7 @@
165 165  **Clock,** milliseconds
166 166  )))|(% colspan="1" %)(% colspan="1" %)
167 167  (((
168 -Sets a variable to true if the time in milliseconds passed
186 +Sets a variable to true for one tick if the time in milliseconds passed since the last time it was set to true.
169 169  )))|(% colspan="1" %)(% colspan="1" %)
170 170  (((
171 171  input
... ... @@ -205,7 +205,7 @@
205 205  **Time**
206 206  )))|(% colspan="1" %)(% colspan="1" %)
207 207  (((
208 -Reads the elapsed time since program start
226 +Reads the elapsed time since program start (milliseconds)
209 209  )))|(% colspan="1" %)(% colspan="1" %)
210 210  (((
211 211  input
... ... @@ -214,7 +214,7 @@
214 214  int
215 215  )))|(% colspan="1" %)(% colspan="1" %)
216 216  (((
217 -
235 +\\
218 218  )))|(% colspan="1" %)(% colspan="1" %)
219 219  (((
220 220  timing.ftl
... ... @@ -221,7 +221,7 @@
221 221  )))
222 222  |(% colspan="1" %)(% colspan="1" %)
223 223  (((
224 -**TickDuration,** targetInMilliseconds
242 +**TickLoopDuration,** targetInMilliseconds
225 225  )))|(% colspan="1" %)(% colspan="1" %)
226 226  (((
227 227  Delays the execution until the tick loop takes at least as long as the given target duration.
... ... @@ -236,6 +236,8 @@
236 236  )))|(% colspan="1" %)(% colspan="1" %)
237 237  (((
238 238  Should be used on the very first input variable in the model, such that waiting is the last action in the tick loop.
257 +
258 +In case the actual tick loop duration is longer than the target duration, the modeler can provide some error handling.
239 239  )))|(% colspan="1" %)(% colspan="1" %)
240 240  (((
241 241  timing.ftl
... ... @@ -242,6 +242,32 @@
242 242  )))
243 243  |(% colspan="1" %)(% colspan="1" %)
244 244  (((
265 +**TickWakeUp**
266 +)))|(% colspan="1" %)(% colspan="1" %)
267 +(((
268 +(% class="content-wrapper" %)
269 +(((
270 +Sets the input variable to the current system time (milliseconds). The model can add to this variable to get a new value. This is the next system time the tick function will be called.
271 +
272 +In other words, the next tick function call is delayed until the wake up time has been reached.
273 +
274 +For instance the statement **nextTickWakeUp += 500** could be used to call the tick function again in 500 milliseconds, if nextTickWakeUp is an input with the corresponding annotation.
275 +)))
276 +)))|(% colspan="1" %)(% colspan="1" %)
277 +(((
278 +input
279 +)))|(% colspan="1" %)(% colspan="1" %)
280 +(((
281 +int
282 +)))|(% colspan="1" %)(% colspan="1" %)
283 +(((
284 +Should be used on the very last input variable in the model, such that waiting and settings the system time is the last action done, before the tick function call.
285 +)))|(% colspan="1" %)(% colspan="1" %)
286 +(((
287 +timing.ftl
288 +)))
289 +|(% colspan="1" %)(% colspan="1" %)
290 +(((
245 245  **Sleep**
246 246  )))|(% colspan="1" %)(% colspan="1" %)
247 247  (((
... ... @@ -254,7 +254,7 @@
254 254  int
255 255  )))|(% colspan="1" %)(% colspan="1" %)
256 256  (((
257 -
303 +\\
258 258  )))|(% colspan="1" %)(% colspan="1" %)
259 259  (((
260 260  timing.ftl
... ... @@ -292,7 +292,7 @@
292 292  string
293 293  )))|(% colspan="1" %)(% colspan="1" %)
294 294  (((
295 -
341 +\\
296 296  )))|(% colspan="1" %)(% colspan="1" %)
297 297  (((
298 298  print.ftl
... ... @@ -330,7 +330,7 @@
330 330  bool
331 331  )))|(% colspan="1" %)(% colspan="1" %)
332 332  (((
333 -
379 +\\
334 334  )))|(% colspan="1" %)(% colspan="1" %)
335 335  (((
336 336  touch_and_buttons.ftl
... ... @@ -391,7 +391,7 @@
391 391  bool
392 392  )))|(% colspan="1" %)(% colspan="1" %)
393 393  (((
394 -
440 +\\
395 395  )))|(% colspan="1" %)(% colspan="1" %)
396 396  (((
397 397  light.ftl
... ... @@ -410,7 +410,7 @@
410 410  bool
411 411  )))|(% colspan="1" %)(% colspan="1" %)
412 412  (((
413 -
459 +\\
414 414  )))|(% colspan="1" %)(% colspan="1" %)
415 415  (((
416 416  light.ftl
... ... @@ -450,7 +450,7 @@
450 450  bool
451 451  )))|(% colspan="1" %)(% colspan="1" %)
452 452  (((
453 -
499 +\\
454 454  )))|(% colspan="1" %)(% colspan="1" %)
455 455  (((
456 456  motor.ftl
... ... @@ -469,7 +469,7 @@
469 469  int
470 470  )))|(% colspan="1" %)(% colspan="1" %)
471 471  (((
472 -
518 +\\
473 473  )))|(% colspan="1" %)(% colspan="1" %)
474 474  (((
475 475  motor.ftl
... ... @@ -549,7 +549,7 @@
549 549  int
550 550  )))|(% colspan="1" %)(% colspan="1" %)
551 551  (((
552 -
598 +\\
553 553  )))|(% colspan="1" %)(% colspan="1" %)
554 554  (((
555 555  ultrasonic.ftl
... ... @@ -597,7 +597,7 @@
597 597  gyro.ftl
598 598  )))
599 599  
600 -
646 +\\
601 601  
602 602  ----
603 603  
... ... @@ -641,7 +641,7 @@
641 641  Uploading to the brick does not respond
642 642  )))|(% colspan="1" %)(% colspan="1" %)
643 643  (((
644 -
690 +\\
645 645  )))|(% colspan="1" %)(% colspan="1" %)
646 646  (((
647 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.
... ... @@ -667,7 +667,7 @@
667 667  Brick does nothing after program finished and prints "Program exit"
668 668  )))|(% colspan="1" %)(% colspan="1" %)
669 669  (((
670 -
716 +\\
671 671  )))|(% colspan="1" %)(% colspan="1" %)
672 672  (((
673 673  A program was uploaded and finished without errors. Afterwards the brick prints "Program exit" but does not open the main menu.
... ... @@ -676,8 +676,6 @@
676 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 677  )))
678 678  
679 -
725 +\\
680 680  
681 -
682 -
683 -input
727 +\\
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -20153911
1 +37814289
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/20153911/LEGO Mindstorms with leJOS and SCCharts
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/37814289/LEGO Mindstorms with leJOS and SCCharts