Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
mindstorms:plnxt:start [2009/02/17 13:09] gjn |
mindstorms:plnxt:start [2019/06/27 15:50] (current) |
| |
====== PLNXT Introduction ====== | ====== PLNXT Introduction ====== |
LEGO Mindstorms NXT is a universal platform, that offers robot construction possibilities, as well as programming solutions. When it comes to Mindstorms NXT programming, LEGO offers a programming environment, that allows for algorithm synthesis using simple flowchart-like visual language. Thanks to the openness of the platform number of open programming solutions emerged, for languages such as C/C + +, Java, etc. The examples include LeJOS/iCommand ([[http://lejos.sourceforge.net]]), and NQC ([[http://bricxcc.sourceforge.net/nqc]]). Some early attempts for providing a Prolog-based solution are within the Legolog Project ([[http://www.cs.toronto.edu/cogrobo/Legolog]]). Unfortunately the project did not offer a general API, and supported only the older Mindstorms RCX version. | LEGO Mindstorms NXT is a universal platform, that offers robot construction possibilities, as well as programming solutions. When it comes to Mindstorms NXT programming, LEGO offers a programming environment, that allows for algorithm synthesis using simple flowchart-like visual language. Thanks to the openness of the platform number of open programming solutions emerged, for languages such as C/C + +, Java, etc. The examples include [[http://lejos.sourceforge.net|LeJOS/iCommand]], and [[http://bricxcc.sourceforge.net/nqc|NQC]]. Some early attempts for providing a Prolog-based solution are within the [[http://www.cs.toronto.edu/cogrobo/Legolog|Legolog Project]]. Unfortunately the project did not offer a general API, and supported only the older Mindstorms RCX version. |
| |
//PLNXT// is a Prolog API for the Mindstorms NXT platform. It is researched and developed within the HeKatE Project [[http://hekate.ia.agh.edu.pl]], aimed at providing a high-level rule-based programming solution. | //PLNXT// is a Prolog API for the Mindstorms NXT platform. It is researched and developed within the [[http://hekate.ia.agh.edu.pl|HeKatE Project]], aimed at providing a high-level rule-based programming solution. |
| |
Basing on the review of existing solutions, the requirements of a new Prolog API for NXT has been formulated: | Basing on the review of existing solutions, the requirements of a new Prolog API for NXT has been formulated: |
* at the functional level the API is coherent with other available solutions. | * at the functional level the API is coherent with other available solutions. |
| |
===== The following three layer API architecture has been designed ===== | ===== Architecture ===== |
* The **behavioral layer** (nxt_movement) exposes to the programmer some high level functions and services. It provides abstract robot control functions, such as go, or turn. Currently works for a [[http://mindstorms.lego.com/Overview/MTR_Tribot.aspx|TriBot]] robot. Ultimately a full movement support for different robots is to be provided. | * The **behavioral layer** (nxt_movement) exposes to the programmer some high level functions and services. It provides abstract robot control functions, such as go, or turn. Currently works for a [[http://mindstorms.lego.com/Overview/MTR_Tribot.aspx|TriBot]] robot. Ultimately a full movement support for different robots is to be provided. |
* The **sensomotoric layer** (nxt_sensomoto) controls the components of the Mindstorms NXT set: motors, all the sensors, as well as Brick functions. This layer can be used to directly read the sensors, as well as program the motors. This is a layer, that can be used by a programmer to enhance high-level behavioral functions. | * The **sensomotoric layer** (nxt_sensomoto) controls the components of the NXT set: motors, all the sensors, as well as Brick functions. This layer can be used to directly read the sensors, as well as program the motors. This is a layer, that can be used by a programmer to enhance high-level behavioral functions. |
* The goal of the **communication layer** (nxt_actions) is to execute the actions of the sensomotoric layer and communicate with the NXT Brick. Currently in this layer several alternate modules are present, providing different means of communication: | * The goal of the **communication layer** (nxt_actions) is to execute the actions of the sensomotoric layer and communicate with the NXT Brick. Currently in this layer several alternate modules are present, providing different means of communication: |
* a pure Prolog module, using a serial port communication, and the NXT protocol commands, | * a pure Prolog module, using a serial port communication, and the NXT protocol commands, |
* a hybrid socket-based solution, using the NXT++ library, that communicates with the robot, | * a hybrid socket-based solution, using the NXT++ library, that communicates with the robot, |
* simple graphic NXT simulator, which allows, within a certain scope, of using algorithms without Mindstorms set.\\ | * simple graphic NXT simulator, which allows, within a certain scope, of using algorithms without Mindstorms set.\\ |
All of these actually wrap the Mindstorms NXT Communication Protocol. | All of these (except for simulator) actually wrap the Mindstorms NXT Communication Protocol. |
| |
Any other implementation of the communication layer can be created based on file nxt_actions_dummy.pl. | Any other implementation of the communication layer can be created based on file nxt_actions_dummy.pl. |
Restriction is that the names of the exported predicates must remain the same. There is also no possibility to provide anything new without including it in the sensomotoric layer. Why? The communication layer is a part of the project, detached to allow putting various alternate versions into its place only. **It should not be directly used in the projects based on PlNXT. There is no such need.** | Restriction is that the names of the exported predicates must remain the same. There is also no possibility to provide anything new without including it in the sensomotoric layer. Why? The communication layer is a part of the project, detached to allow putting various alternate versions into its place only. **It should not be directly used in the projects based on PlNXT. There is no such need.** |
| |
===== Threads as an additional component ===== | ===== Threads ===== |
| To implement complex control algorithms, it is necessary to use mechanisms for delaying actions and make them conditional on certain events. |
| |
To implement complex control algorithms, it is necessary to use mechanisms for delaying actions and make them conditional on certain events. | Implementation of these mechanisms occurs in the ''threads'' module. It provides triggers (callbacks) and timers using SWI Prolog threads. Trigger fires an action when some event occurs. Timer fires an action after a specified period of time. |
Implementation of these mechanisms occurs in the threads module. It provides triggers (callbacks) and timers using SWI Prolog threads. Trigger fires an action when some event occurs. Timer fires an action after a specified period of time. | |
| |
====== About LEGO Mindstorms NXT platform ====== | ====== About LEGO Mindstorms NXT platform ====== |
| |
===== The minimum knowledge of the NXT needed to use the PLNXT ===== | The minimum knowledge needed to use the PLNXT: |
| * [[mindstorms:description|A short description]]. |
| * [[mindstorms:kit|LEGO Mindstorms NXT set]]. |
| * [[mindstorms:interface|Description of the most useful elements of the brick interface.]] |
| |
==== LEGO Mindstorms NXT set ==== | These materials are part of the [[mindstorms:start|AGH Laboratory - LEGO Mindstorms]] site. |
| |
Mindstorms NXT set includes: | ====== Documentation ====== |
* Brick. | |
* Sensors: | |
* //Touch sensor.// Pompous name. In fact, it is a simple button, which recognizes two states (pressed, released). | |
* //Sound sensor.// | |
* //Light sensor.// Equipped with a red LED. The inclusion of diode allows recognizing colors (in a grayscale) in low light conditions. | |
* //Ultrasonic sensor.// It is the one somewhat similar to the praying mantis head. With two large "eyes". It examines the distance between the sensor and the nearest obstacle using ultrasonic. Range up to 255 cm. | |
* Three servo motors. | |
* Lego bricks which can be used to build robots using elements above. | |
| |
==== Combining components ==== | FIXME on-line docs |
| |
Motors used for movement should be connected to B and C ports. Motor used for an extra function – to A port. | ====== Download ====== |
Standard input port connections (can be different): | ===== Release M0 ===== |
* Port 1: touch sensor. | //20.02.2009//: Download release {{:plnxt:plnxt-m0.tar.gz|PlNXT-M0}} |
* Port 2: sound sensor. | ===== Release M3 ===== |
* Port 3: light sensor. | //09.05.2010//: Download release {{:plnxt:plnxt-m3.1.tar.gz|PlNXT-M3.1}} |
* Port 4: ultrasonic sensor. | |
| |
==== Interface ==== | ====== Setup ====== |
| |
=== Buttons === | If you have not used the Mindstorms NXT yet, I recommend the LEGO instruction. Nice, colorful, with pictures. :) If you are too lazy for that, start with a [[#about_lego_mindstorms_nxt_platform|LEGO Mindstorms NXT]] brief description, necessary to use PLNXT. There is a knowledge of the NXT platform there, reduced as it can be. |
You can turn the NXT on by pressing the orange button. The same button confirm choices in the menu. To move around between positions, use the triangle-shaped buttons. Dark button below is used to cancel a selection and to turn the NXT off (when you are in the main menu). | |
| |
=== Bluetooth === | Download and unzip the current version of PLNXT. You can find it in the [[#download|download section]]. |
Turning BT can be found in the NXT menu. Choose: Bluetooth -> On / Off -> {On or Off}. | |
When BT is turned on, in the upper left corner of the display there is a symbol of BT and to the right of it there is a '<' symbol. After a connection is established next to a '<' symbol appears '>' symbol. Together: '<>'. After a connection is closed a '>' symbol disappears. | |
| |
=== Batteries === | ===== Environment setup ===== |
In the upper right corner of the display there is a battery level indicator. When it is black as a whole, the batteries are full. | |
| |
==== Settings ==== | Various communication modules require different environment preparation: |
| * ''nxt_actions_serial'' -- using local serial port, |
| * ''nxt_actions_icommand'' -- using [[http://lejos.sourceforge.net/icommand.php|iCommand]] (Java), |
| * ''nxt_actions_sockets'' -- using TCP sockets. |
| |
=== Sleep === | Temporarily, it is possible to use only the ''serial'' module. Soon this will be corrected. Therefore, further instructions are prepared only for this module. |
NXT has a "sleep" function. It is set to 10 minutes by default. If by that time, no button will be pressed, a NXT deactivates. This means that it can also do this during work. This can be really annoying. To turn this function of, select from the menu: Settings -> Sleep -> Never. | |
| |
=== Sound === | ==== Serial module ==== |
NXT can make annoying sounds when it's turned on. You can turn them off from the menu by selecting: Settings -> Volume -> 0. | [[conf_serial|Setup for GNU/Linux]] |
| |
=== Sensor readings === | ==== iCommand module ==== |
The sensors reading can be read directly form the NXT menu. Please select View -> {sensor_type} -> {port} | |
| |
====== Documentation ====== | ==== Sockets module ==== |
| |
FIXME on-line docs | ====== First steps ====== |
| If you already have a properly prepared environment (see [[#setup|setup]]), you can move on and write simple programs. I encourage you to review [[first_steps|''first steps'']]. |
| |
====== Download ====== | ====== Related sites ====== |
FIXME | |
| |
====== Quick Start ====== | See [[mindstorms:links]] at the [[mindstorms:start|AGH Laboratory - LEGO Mindstorms]] site. |
| |
If you have not used the Mindstorms NXT yet, I recommend the LEGO instruction. Nice, colorful, with pictures. :) If you are too lazy for that, start with a brief description of Mindstorms NXT (FIXME link), necessary to use PLNXT. There is a knowledge of the NXT platform there, reduced as it can be. | |
| |
Download and unzip the current version of PLNXT. You can find it in the download section [[student:msc2009_nxtapi:plnxt_en#download|download section]]. | |
| |
===== Przygotowanie środowiska ===== | |
| |
Various communication modules require different environment preparation. Temporarily, it is possible to use only the “serial” module. Soon this will be corrected. Therefore, further instructions are prepared only for this module. | |
| |
==== nxt_actions_serial module ==== | |
==== nxt_actions_icommand module ==== | |
==== nxt_actions_sockets module ==== | |
| |
====== First steps ====== | |
====== Related sites ====== | |
====== Licence ====== | ====== Licence ====== |
| |
| |
You should have received a copy of the GNU General Public License along with PLNXT. If not, see [[http://www.gnu.org/licenses/]]. | You should have received a copy of the GNU General Public License along with PLNXT. If not, see [[http://www.gnu.org/licenses/]]. |
| |
| {{:hekate:gplv3.png|GPLv3}} |
| |
====== Contact ====== | ====== Contact ====== |
* you want to give us advices, suggestions, comments, etc. | * you want to give us advices, suggestions, comments, etc. |
| |
E-mail: holownia(_at_)agh.edu.pl | E-mail: holownia(_at_)agh.edu.pl or gjn(_at_)agh.edu.pl |
| |
| ====== Development ====== |
| For [[mindstorms:plnxt:plnxtdev:start|developers]]. |
| |
====== News/problems ====== | ====== News/problems ====== |
| |
**Jan 14, 2009**\\ | * **Jan 14, 2009** -- PLNXT was used during classes with students. We hope to get feedback that will help remove errors. Before that, work on the communication layer module using serial connection, based directly on the LEGO protocol, were in progress. This protocol provides greater capabilities than used previously icommand and sockets modules. One of its features is that it can synchronize engines. Higher layer has been modified to make the most of what provides the LEGO protocol. It should be re-converted so it could be used with communication layer modules, which do not provide engines synchronization, as well as these modules. At this point, it is possible to use only the serial module as a communication layer. |
PLNXT was used during classes with students. We hope to get feedback that will help remove errors. Before that, work on the communication layer module using serial connection, based directly on the LEGO protocol, were in progress. This protocol provides greater capabilities than used previously icommand and sockets modules. One of its features is that it can synchronize engines. Higher layer has been modified to make the most of what provides the LEGO protocol. It should be re-converted so it could be used with communication layer modules, which do not provide engines synchronization, as well as these modules. At this point, it is possible to use only the serial module as a communication layer. | |