110 likes | 281 Vues
OGEL: LEGO Mindstorm Controller Language. Michael Ching Gerardo Flores Matt Kalish Charles O’Donnell May 13, 2003. LEGO Mindstorms. Robotic architecture that allows one to build components from Legos and control sensors and motors from a microcontroller
E N D
OGEL:LEGO Mindstorm Controller Language Michael Ching Gerardo Flores Matt Kalish Charles O’Donnell May 13, 2003
LEGO Mindstorms • Robotic architecture that allows one to build components from Legos and control sensors and motors from a microcontroller • Complexity of microcontroller can be chosen (Scout, RCX 1.0, RCX 2.0, CyberMaster) • Different development environments may be chosen that vary from a drag and drop approach to a C-syntax based language
Not Quite C • Targets experienced programmers • C syntax and semantics • Textual language removes the graphical metaphors that limit the type of programs that may be written • Supported by several IDEs (WinNQC, MacNQC, Visual NQC, NQCEdit, Bricx Command Center) • Not modular in nature • Does not support hierarchy or abstraction of code • Questionable event-based support
OGEL • Designed to support the RCX 1.0 but offers support for future firmware (Compatible with 2.0) • Merge desirable characteristics of available technologies • Built scalable hierarchy which improves code reuse
OGEL (Cont’d) • Able to create code for multiple target microcontrollers from one file • Improved message passing architecture • Improved modularity which leads to a more stable hierarchy • Allows imbedded self-contained Not Quite C code • Permits separation of RCX, task, message, and function declarations into library files which can be added to any existing code by means of include statements
Architecture Discussion • 5 Stages: Preprocessor, Lexer/Parser, Static-Semantic Checking, UNI-OGEL Generator, Architectural Translator. • Preprocessor: #include, #define, task/function order independence
Architecture Discussion • Lexer/Parser – Static-Semantic Checking • UNI-OGEL Generator: code duplication & port mapping, source code profiling • Architectural Translator: any architecture, architecture-specific errors discovered (task limit, recursion), optimization
Testing • Testing was done in 3 phases • Isolated Module Testing • Integration Testing • Final Testing
Sample OGEL Code #define TIME_REV 100 message done; rcx demo { SENSOR_TOUCH hit = $1; left_motor = $A; right_motor = $C; } task go(in hit)(out left_motor, out right_motor) { when (hit>0) do reverse(); nqc.OnFwd(left_motor + right_motor); } void turn()()(out left_motor, out right_motor) { nqc.OnRev(left_motor); nqc.OnFwd(right_motor); nqc.Wait(TIME_REV); nqc.Off(left_motor + right_motor); throw done; } void reverse()()(out left_motor, out right_motor) { nqc.OnRev(left_motor + right_motor); nqc.Wait(TIME_REV); nqc.Off(left_motor + right_motor); turn(); } task rev_task()(out left_motor, out right_motor) { int x = 1; while (x > 0) { catch done; reverse(); } } task main() { rcx demo first_born; first_born.addTask(rev_task); first_born.addTask(go); }
Watch This Puppy run! Division of Work: Front-End: Michael Ching / Gerardo Flores Back-End: Charles O’Donnell Floater, Docs Compilation: Matt Kalish