Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim [email protected].
-
Upload
elizabeth-parsons -
Category
Documents
-
view
216 -
download
0
Transcript of Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim [email protected].
![Page 2: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/2.jpg)
Outline
• Programmable LEGO • Logo and LEGO• NXT: features and the ways to program it• Why Logo for NXT?• NXT Logo!• Show…• Under the hood (NXT Logo internals)• The work remaining
![Page 3: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/3.jpg)
Robotics in Education
Positive aspects:• demonstrate phenomena in novel and more ample ways,• provide creative platforms for hands-on exploration for
individual or group student work,• increase entertainment experience during the learning
process, • increase motivation for learning,• spawn interest in technology among students,
Drawbacks and challenges:• high cost of robots,• extra time, space, work and competence required from
teachers and schools,• shortage of curriculum materials and guidelines.
![Page 4: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/4.jpg)
After-school Robotics Clubs
… perform important pioneering work
![Page 5: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/5.jpg)
Programmable LEGO
• Early 90s: LEGO Dacta wired computer interface, well integrated into physics curriculum
• 1st autonomous: CodePilot (1997) programmed using barcodes
• Mindstorms (1998) based on 8-bit Microcontroller, 32KB RAM, IR serial communication, iconic programming language with parallel events: used in many competitions (First LEGO League, RoboCup, LineFollowing, Micromouse, etc.) Many alternative programming environments;
• NXT (2006) = RCX improved
![Page 6: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/6.jpg)
Logo and LEGO
• Very close relation since the beginnings of robotics LEGO
• Successful product (LEGO Logo) for wired LEGO Dacta
• Powerful parallelism, direct and easy graphical visualization of data on screen
• Concept abandoned with the arrival of autonomous brick
![Page 7: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/7.jpg)
NXT features and programming
• Compatible with RCX sensors and motors• Radio BT communication• Supports standard I2C bus/sensors• Programmed over USB cable• Graphical display• Powerful motors with built-in rotation sensors• Compact rechargeable Li-ion battery• Public full documentation of specifications• Programmed in new version of RoboLab
(LabView), RobotC, NXC, NBC, PbLua, Lejos, Microsoft R.S. etc.)
![Page 8: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/8.jpg)
Why Logo for NXT?
• Shortcomings of RoboLab:– applications run only on robots despite BT
Radio, little support for making interactive projects
– difficult to learn– no textual form, slow, hard to maintain, debug
• Logo users love to use robots!• Large community of Logo users – large
potential for NXT robots
![Page 9: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/9.jpg)
NXT Logo!
• Direct interactive control of NXT brick from Imagine controller project
• A loadable project with set of predefined procedures and operations that are supported by firmware
• Logo interpreter written in NBC – communicates interactively with Imagine
(remote remote-expression)
![Page 10: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/10.jpg)
NXT Logo Internals
• Implemented in low-level language NBC for reasons of efficiency;
• NXT firmware: insufficient memory management, our own internal C-style memory management;
• Garbage collection on demand;• Careful handling of memory: use pointer
references where possible (each word stored only once, no destructive operations – i.e. shared structures);
![Page 11: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/11.jpg)
NXT Logo Internals
• Parser – converts string expression to internal representation
• Printer – inverse to parser
• ‘Evaleval’ – performs one step of evaluation of list-expression (i.e. evaluates one number, word, or function call)
• Eval – evaluates complete list-expression, i.e. function body
![Page 12: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/12.jpg)
NXT Logo Internals
• Word and variables stored in ordered symbol tables (for fast lookup), which also feature fast insert/delete
![Page 13: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/13.jpg)
NXT Logo Internals
• NBC does not support recursion – we simulate it using stack structures and direct jumps
• More than 60 primitive procedures: conditions, iterations, variables, list operations, integer arithmetic, logic operations, NXT motor and sensor control, NXT file system, etc.
• Only prefix operations and fixed argument count – no parentheses!
• As compatible with Imagine Logo as possible• Expressions sent and returned directly between
Imagine running on PC and NXT Logo• Support for parallelism (not implemented yet)
![Page 14: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/14.jpg)
Gears projectto measureRatio setsensor 1 “angle setsensor 2 “angle setsensor 1 “rst setsensor 2 “rst motor “A “power 50 ; rotate the first wheel 10-
times while [gt? 160 sensor 1] [ ] ; sensor2 measures the
opposite ; side, output the ratio op list sensor 1 sensor 2 end
![Page 15: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/15.jpg)
Pulleys Projectto movePlatform setsensor 1 “lightA let “threshold 30 motor “C “power 15 motor “C “on while [lt? sensor
1 :threshold] [] motor “C “offend
![Page 16: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/16.jpg)
Remaining Work
• Fill-in the missing blanks
• Update manual
• Make version independent from Imagine
• Brick to brick communication
• Advanced features, USB communication
• Provide more examples
• Find the user community
• Open-source project
![Page 17: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/17.jpg)
Summary
• Functional language for NXT
• NXT control for Logo users
• Large NBC project
• Novel approach based completely
on interactive radio communication
• Bringing NXT closer to teachers, students, and classrooms
![Page 18: Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim ppetrovic@acm.org.](https://reader030.fdocuments.net/reader030/viewer/2022032803/56649e385503460f94b285c0/html5/thumbnails/18.jpg)
Thank you for attention…
… and see you at the workshop on Friday!