Changes for page LEGO Mindstorms with leJOS and SCCharts
Last modified by Alexander Schulz-Rosengarten on 2023/09/11 16:17
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -77,9 +77,11 @@ 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:Screenshot_20171016_130805.png]] 81 + 80 80 **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). 81 81 82 - [[image:attach:lejos_eclipse_plugin.png]]84 +\\ 83 83 84 84 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**. 85 85 ... ... @@ -98,7 +98,7 @@ 98 98 1. The project wizard from the leJOS plugin opens. Set the project name to //Flashlight// and click //finish//. 99 99 1. The project is created and the model file is opened in an editor (This might take a few seconds). 100 100 101 -=== Edit the model: ===103 +=== Edit the Model: === 102 102 103 103 Change the contents of the model file to the following code and save it. 104 104 ... ... @@ -123,24 +123,38 @@ 123 123 124 124 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. 125 125 126 -The available wrapper code snippets are defined in the //snippets//directoryof theroject 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. 127 127 128 128 **Note:** The Floodlight of the EV3 has a pretty high latency when switching between on and off. 129 129 130 -**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 EclipseLuna isupdates/stable/luna/>>url:http://download.jboss.org/jbosstools/updates/stable/luna/||shape="rect"]]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).** 131 131 ** 132 132 133 -=== Launchtheproject: ===135 +=== Build the Project: === 134 134 135 - Withthe mouse over theSCTfile in the projectexplorer,perform//RightClick>RunAs>KiCoCompilation.//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. 136 136 137 - A launchconfigiscreated,whichcompilesthemodel toJava code and createswrappercode from the annotationsinthe modelfile.Afterwardsthis outputiscompiledand deployed to the Mindstormsbrick, 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. 138 138 139 - For a deeperunderstandingoftheprojectlaunchandinitialization,take alook atthe [[wikipageforProm>>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. 140 140 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 + 141 141 === Available Wrapper Code Snippets === 142 142 143 -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. 144 144 145 145 For sensors, the port has to be on of S1, S2, S3, S4. 146 146 ... ... @@ -216,7 +216,7 @@ 216 216 int 217 217 )))|(% colspan="1" %)(% colspan="1" %) 218 218 ((( 219 - 235 +\\ 220 220 )))|(% colspan="1" %)(% colspan="1" %) 221 221 ((( 222 222 timing.ftl ... ... @@ -223,7 +223,7 @@ 223 223 ))) 224 224 |(% colspan="1" %)(% colspan="1" %) 225 225 ((( 226 -**TickDuration,** targetInMilliseconds 242 +**TickLoopDuration,** targetInMilliseconds 227 227 )))|(% colspan="1" %)(% colspan="1" %) 228 228 ((( 229 229 Delays the execution until the tick loop takes at least as long as the given target duration. ... ... @@ -244,6 +244,27 @@ 244 244 ))) 245 245 |(% colspan="1" %)(% colspan="1" %) 246 246 ((( 263 +**TickWakeUp** 264 +)))|(% colspan="1" %)(% colspan="1" %) 265 +((( 266 +Sets the input variable to the current system time. The model can add to this variable to get a new value. This is the next system time it will be called. 267 + 268 +This means the next tick function call is delayed until the wake up time has been reached. 269 +)))|(% colspan="1" %)(% colspan="1" %) 270 +((( 271 +input 272 +)))|(% colspan="1" %)(% colspan="1" %) 273 +((( 274 +int 275 +)))|(% colspan="1" %)(% colspan="1" %) 276 +((( 277 +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. 278 +)))|(% colspan="1" %)(% colspan="1" %) 279 +((( 280 +timing.ftl 281 +))) 282 +|(% colspan="1" %)(% colspan="1" %) 283 +((( 247 247 **Sleep** 248 248 )))|(% colspan="1" %)(% colspan="1" %) 249 249 ((( ... ... @@ -256,7 +256,7 @@ 256 256 int 257 257 )))|(% colspan="1" %)(% colspan="1" %) 258 258 ((( 259 - 296 +\\ 260 260 )))|(% colspan="1" %)(% colspan="1" %) 261 261 ((( 262 262 timing.ftl ... ... @@ -294,7 +294,7 @@ 294 294 string 295 295 )))|(% colspan="1" %)(% colspan="1" %) 296 296 ((( 297 - 334 +\\ 298 298 )))|(% colspan="1" %)(% colspan="1" %) 299 299 ((( 300 300 print.ftl ... ... @@ -332,7 +332,7 @@ 332 332 bool 333 333 )))|(% colspan="1" %)(% colspan="1" %) 334 334 ((( 335 - 372 +\\ 336 336 )))|(% colspan="1" %)(% colspan="1" %) 337 337 ((( 338 338 touch_and_buttons.ftl ... ... @@ -393,7 +393,7 @@ 393 393 bool 394 394 )))|(% colspan="1" %)(% colspan="1" %) 395 395 ((( 396 - 433 +\\ 397 397 )))|(% colspan="1" %)(% colspan="1" %) 398 398 ((( 399 399 light.ftl ... ... @@ -412,7 +412,7 @@ 412 412 bool 413 413 )))|(% colspan="1" %)(% colspan="1" %) 414 414 ((( 415 - 452 +\\ 416 416 )))|(% colspan="1" %)(% colspan="1" %) 417 417 ((( 418 418 light.ftl ... ... @@ -452,7 +452,7 @@ 452 452 bool 453 453 )))|(% colspan="1" %)(% colspan="1" %) 454 454 ((( 455 - 492 +\\ 456 456 )))|(% colspan="1" %)(% colspan="1" %) 457 457 ((( 458 458 motor.ftl ... ... @@ -471,7 +471,7 @@ 471 471 int 472 472 )))|(% colspan="1" %)(% colspan="1" %) 473 473 ((( 474 - 511 +\\ 475 475 )))|(% colspan="1" %)(% colspan="1" %) 476 476 ((( 477 477 motor.ftl ... ... @@ -551,7 +551,7 @@ 551 551 int 552 552 )))|(% colspan="1" %)(% colspan="1" %) 553 553 ((( 554 - 591 +\\ 555 555 )))|(% colspan="1" %)(% colspan="1" %) 556 556 ((( 557 557 ultrasonic.ftl ... ... @@ -599,7 +599,7 @@ 599 599 gyro.ftl 600 600 ))) 601 601 602 - 639 +\\ 603 603 604 604 ---- 605 605 ... ... @@ -643,7 +643,7 @@ 643 643 Uploading to the brick does not respond 644 644 )))|(% colspan="1" %)(% colspan="1" %) 645 645 ((( 646 - 683 +\\ 647 647 )))|(% colspan="1" %)(% colspan="1" %) 648 648 ((( 649 649 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. ... ... @@ -669,7 +669,7 @@ 669 669 Brick does nothing after program finished and prints "Program exit" 670 670 )))|(% colspan="1" %)(% colspan="1" %) 671 671 ((( 672 - 709 +\\ 673 673 )))|(% colspan="1" %)(% colspan="1" %) 674 674 ((( 675 675 A program was uploaded and finished without errors. Afterwards the brick prints "Program exit" but does not open the main menu. ... ... @@ -678,8 +678,6 @@ 678 678 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. 679 679 ))) 680 680 681 - 718 +\\ 682 682 683 - 684 - 685 -input 720 +\\
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 - 201539161 +37814287 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/ 20153916/LEGO Mindstorms with leJOS and SCCharts1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/37814287/LEGO Mindstorms with leJOS and SCCharts