Using FTP Prof. Wayne Pollock Hillsborough Community College Tampa, FL [email protected].
Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim [email protected].
-
Upload
elizabeth-parsons -
Category
Documents
-
view
215 -
download
0
Transcript of Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim [email protected].
Program your NXT robot with Imagine
Pavel PetrovičIDI NTNU, [email protected]
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
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.
After-school Robotics Clubs
… perform important pioneering work
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
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
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.)
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
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)
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);
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
NXT Logo Internals
• Word and variables stored in ordered symbol tables (for fast lookup), which also feature fast insert/delete
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)
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
Pulleys Projectto movePlatform setsensor 1 “lightA let “threshold 30 motor “C “power 15 motor “C “on while [lt? sensor
1 :threshold] [] motor “C “offend
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
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
Thank you for attention…
… and see you at the workshop on Friday!