A Gentler Introduction to Mindstorm NXT Programming

Total Page:16

File Type:pdf, Size:1020Kb

A Gentler Introduction to Mindstorm NXT Programming A Gentler Introduction to Mindstorm NXT Programming Zhizhang Shen ∗ Dept. of Computer Science and Technology Plymouth State University Contents 1 An introduction 2 1.1 Thenatureofarobot............................... 2 1.1.1 Whatisarobot? ............................. 2 1.1.2 Robotparadigms ............................. 3 1.1.3 Behaviorcontrol ............................. 6 1.1.4 Evaluationcriteria ... .. .. .. .. ... .. .. .. .. ... .. 9 1.2 LegoMindstormNXTrobot . 9 2 Software configuration 11 2.1 JavaJDK ..................................... 11 2.2 Thelejosdialect................................. 12 2.3 TheEclipeIDE.................................. 12 2.4 USBconnection.................................. 12 2.5 TalktotheBrick ................................. 12 2.6 Wirelessconnection.. .. ... .. .. .. .. ... .. .. .. .. ... 12 2.7 Totalrequirements ............................... 13 2.8 Softwareinstallation . 13 3 Get it started 14 3.1 Lejos........................................ 14 3.2 Gettingstarted .................................. 14 3.3 Createanewproject ............................... 16 3.4 Createanewclass ................................ 18 3.5 Compile,linkanddownload . 19 ∗Address correspondence to Dr. Zhizhang Shen, Dept. of Computer Science and Technology, Plymouth State University, Plymouth, NH 03264, USA. E mail address: [email protected]. 1 3.6 Thefinalkick ................................... 22 4 Robot assembly 22 5 Basic programming 23 5.1 TheLCDscreen.................................. 23 5.2 Delay........................................ 23 5.3 Thebuttons.................................... 24 5.4 Themotors .................................... 25 5.4.1 Basicoperations ............................. 25 5.4.2 The Navigator API ........................... 26 5.5 Sensors....................................... 29 5.5.1 Touchsensor ............................... 29 5.5.2 Lightsensor................................ 30 5.5.3 Soundsensor ............................... 30 5.5.4 Ultrasonicsensor ............................. 30 5.5.5 Rotationsensors ............................. 31 5.5.6 Othersensors ............................... 31 5.5.7 Soundplayer ............................... 33 5.6 Currentprogramming. .. ... .. .. .. .. ... .. .. .. .. ... .. 34 1 An introduction We talk a bit general about what a robot is, and the major paradigms to make it work. We then discuss briefly about the robot kit that we are going to use in this unit, the Lego Mindstorm NXT[1]. 1.1 The nature of a robot 1.1.1 What is a robot? An intelligent robot is a mechanical creature that can function autonomously Being “intelligent” means that the robot does not do things in a mindless, repetitive, way. Being “mechanical” means that we use mechanical building blocks, rather than using biological parts to put together a robot. It also means that a robot is not merely a computer, since as a “creature”, it can move around, change the environment, etc.. Being able to “function autonomously, means that it can operate, self-contained, under all reasonable conditions without the involvement of a human operator. It also means that it can adapt to changes in the environment (e.g., lights go off), and itself (e.g., a wheel falls off) and continue to reach its goal. 2 There are quite a few robot competition, ranging from football games[7] to the DARPA Grand Challenge [2]. Last one, held in October, 2005, a competition for robotic vehicles to complete an under-200 mile, off-road course in the Mojave Desert. The Stanford Racing Team completed the 212.4 km (132-mile) course in just under 7 hours to win a USD 2M prize. The Defense Advanced Research Projects Agency (DARPA) has held its third Grand Challenge competition on November 3, 2007, in Victorville, CA, with a theme of driving in an urban area. Carnegie Mellon’s Tartan Racing Team scored the first place prize of$2 million. Stanford University’s Stanford Racing team came in second for $1 million, and Virginia Tech’s Victor Tango team won the third place prize of $500,000. 1.1.2 Robot paradigms At the very bottom, there are three robotic primitives: SENSE, PLAN, and ACT. A sense function collects information through sensor(s), which a plan function uses to generate a plan. This plan will be carried out by some act functions. More specifically, 1. A function takes in information from its sensors, and produces an output useful for other functions falls into the category of SENSE. 2. A function takes in information either from sensors or from its own knowledge base, and produces one or more tasks for the robot to perform is a PLAN function. 3. Finally, a function produces output commands to motor actuators is an ACT function. A paradigm is a way to look at things. Technically speaking, it is a set of assumptions and/or techniques that characterize an approach to a class of problems. For example, to find a place to live, there are two approaches, one is to rent a house, the other is to buy one. Each of those two approaches comes with a whole set of assumptions (how much money do you have at present? what about the current market? how long do you stay there?...) and techniques (how to pay for it? how to take care of the property? how to remove the snow during the winter?...) There are essential three ways to organize intelligence in robots: hierarchical, reactive, and an hybrid one, which combines the first two. They can be described in the following two ways, either through describing the rela- tionship between the three commonly accepted primitives; or through describing the way in which sensory data is processed and distributed in the robotic system. • The hierarchical paradigm is the oldest one, widely used between 1967 and 1990. Under this paradigm, as shown in Figure 1, a robot operates in a top-down style, based on a world modeling and planning process. This paradigm comes with the assumption that a robot checks out the world, then plans the next action, finally act out the plan. For example, “I see a door, but there is a chair in between, let me come up with a plan to move around the chairs.” 3 Figure 1: Hierarchical paradigm Thus, all the sensing data is gathered into one global model, and fed into a single representation the planner can use, and then routed to actions. Figure 2 shows another way to look at this paradigm, as a transitive flow of events. This Figure 2: Hierarchical paradigm approach has a strong appeal, because there exist planning strategies that, within a finite amount of time, can compute a sequence of motions that guarantees to accomplish the goal or prove that the given task is impossible, as we discussed in the planning part. Moreover, such a sequence can be optimized before it takes place. Essentially, it looks for a shortest path among a bunch of them. This is significant to a mobile robot, since a carefully figured out plan will guarantee that it will not get into a trap of following a long path to a dead-end. Instead, it will be led along a direct, perhaps, even the shortest, path. On the other hand, this approach does have its problems, mainly inefficiency, as we also discussed for the planning task. Such a strategy sometimes leads to unacceptable time and space complexities because of its complicated environment. It might not be a huge concern for a manipulative-type robot, but it can be huge for a mobile robot, since the latter has to carry everything on its back, just like a turtle. Another issue is that it would have to assume the closed world assumption, i.e., the only information you can use are those you know. For example, when the robot reads 4 the sentence that “A girl touches the boy with a bouquet of flowers”, and has to get the flower. It might not be able to do it because it does not have enough information. Something which is not here is that it is usually the boy who has the flower.... Yet another ssue is that sensory information can be directly fed into the action part, without going through a planning stage. For example, the cognitive psychologists suspect that human beings don’t plan ahead, we simply follow our gut feelings. This leads to the next paradigm. • The reactive paradigm, also referred to as the behavior control approach, is intended to overcome some of the shortcomings of the hierarchical paradigm, and had led to many exciting advances during the 1988-1992 period. The reactive paradigm, as shown in Figure 3 simply deletes the planning stage. It thus assumes that the input to an ACT function will always be the direct output of a SENSE function. Sort of gut feeling. Figure 3: Reactive paradigm More specifically, a robot has multiple instances of SENSE-ACT couplings, which are current processes, called behaviors. Each of them takes local sensing data and computes the best action to take, independent of the other processes. Sometimes, it can combine behaviors. For example, One behavior can direct the robot to “move forward 5 feet” (ACT) to reach a goal (as picked up by its SENSE); while the other can direct it to “turn 90◦” since it sensor fears a collision. In this case, the robot will actually turn 45◦ to avoid the collision, although none of the two behaviors directs it to do so. It quickly became obvious that it is too extreme to completely delete the planing stage. For example, if one ACT in a collection leads to “move forward 5 feet”, while the other says “move back 3 feet”, the robot should combine them to move forward 2 feet; rather than move back and forth. 5 • The hybrid model emerged in the 1990’s and continues to be the current area of robotic research. Under this paradigm, a robot firstly plans how to best decompose a task into subtasks, and then find out the best behaviors to get each of them done. Thus, it can be characterized as PLAN, SENSE-ACT. The sensing data is sent to each behavior that needs them, and is also available to the planner for the construction of a task-oriented global model. It is really a mixture of both paradigms. Figure 4 shows a pictorial presentation of this paradigm. Figure 4: Hybrid paradigm 1.1.3 Behavior control As mentioned earlier, behaviors are simply layers of control systems that all run in parallel, implemented as Java threads, whenever appropriate sensors fire.
Recommended publications
  • COURSE CURRICULUM Module Name Credit Units YEAR 1 Level
    COURSE CURRICULUM Module Name Credit Units YEAR 1 Level 1.1 (22.5 hours per week) Career & Professional Preparation l 1.5 Computer Programming 4 Electrical Technology 4 Engineering Mathematics 1 5 Engineering Mechanics 4 Innovation Toolkit: Acquiring the Skills ^ 2 Sports & Wellness ^ 2 Level 1.2 (26 hours per week) Manufacturing Technology & Practice 4 Electronics Technology 4 Engineering Materials 4 Engineering Mathematics 2 5 Automation in a Mechatronic World 3 Communication & Contemporary Issues ^ 4 Innovation Toolkit: Applying the Skills ^ 2 Notes: ^ For more details on Interdisciplinary Studies (IS) electives, please log on to www.np.edu.sg/is/ IS Modules The School of Interdisciplinary Studies (IS) delivers a broad-based curriculum, which nurtures a new generation of professionals with multidisciplinary skills and an innovative and entrepreneurial spirit to meet the challenges of a knowledge economy. IS offers both prescribed modules and electives to challenge boundaries. Prescribed modules develop students’ competencies in core areas such as Communication, Innovation and Enterprise, Culture and Communication, and Personal Mastery and Development, while elective modules provide insights into Arts and Humanities, Business, Design, and Science and Technology. COURSE MODULES LEVEL 1.1 Career & Professional Preparation I This module helps to give students a foundational introduction to their three-year diploma course curriculum and how it prepares them for industry. It will help them to embark on their three-year course with the end in mind, through guided reflection of their personal characteristics, and producing an overall game plan for their future education and career goals. The module aims to deepen students’ commitment to the sector that the course prepares them for.
    [Show full text]
  • Richer Connections to Robotics Through Project Personalization
    Advances in Engineering Education SUMMER 2012 Richer Connections to Robotics through Project Personalization MELANIE VELTMAN VALERIE DAVIDSON and BETHANY DEYELL University of Guelph Guelph, Ontario, Canada ABSTRACT In this work, we describe youth outreach activities carried out under the Chair for Women in Science and Engineering for Ontario (CWSE-ON) program. Specifi cally, we outline our design and implementation of robotics workshops to introduce and engage middle and secondary school students in engineering and computer science. Toward the goal of increasing the participation of women in science and engineering, our workshop design incorporates strategies presented in work by Rusk et al. (2008) on broadening participation in robotics: 1. focusing on themes, not just challenges; 2. combining art and engineering; 3. encouraging story-telling; and 4. organizing exhibitions, rather than competitions (Rusk et al., 2008, page 1) We discuss three workshop themes designed to highlight creativity and provide choices to par- ticipants. Our “Wild in the Rainforest” workshops make use of the PicoCrickets robotics kits and software used and described by Rusk et al. (2008). We also present Lego Mindstorms workshops themed “So You Think Your Robot Can Dance” and “A Day at the Park”. Our workshops are presented by female role models with academic backgrounds in science and engineering. Although workshop periods are fairly short (60-90 minutes), participants learn that robots have perception, cognition, and action – and are tasked with designing and programming to highlight these abilities. We present the results of our workshops through images and videos of the teams’ creations. Workshop evalu- ation data provided by participants demonstrate that our approach results in rich connections to engineering and technology for participants of both genders.
    [Show full text]
  • NXT User Guide Introduction
    NXT User Guide Introduction WELCOME TO LEGO® MINDSTORMS® EDUCATION LEGO® MINDSTORMS® Education is the next generation in educational robotics, enabling students to discover Science, Technology, Engineering and Mathematics in a fun, engaging, hands-on way. By combining the power of the LEGO building system with the LEGO MINDSTORMS Education technology, teams of students can design, build, program, and test robots. Working together on guided and open-ended engineering projects, the team members develop creativity and problem-solving skills along with other important mathematics and science knowledge. Students also become more skilled in communication, organization and research, which helps prepare them for future success in higher levels of schooling and in the workplace. The next technology - now. LEGO MINDSTORMS Education features an advanced 32-bit computer- controlled NXT brick, Interactive Servo Motors, Sound, Ultrasonic and other sensors, Bluetooth communication and multiple downloading capabilities. The icon-based LEGO MINDSTORMS Education NXT Software is built on the LabVIEW™ software from National Instruments, an industry standard with applications in many engineering and research fi elds. Curriculum. Inspiration. Support. The LEGO MINDSTORMS Education website www.MINDSTORMSeducation.com is your main resource for curriculum, training, product information and support. Our partners provide a strong network of information, technical advice, and teacher support as well. Carnegie Mellon Robotics Academy is our partner for developing curriculum materials and activities. Tufts University Center for Engineering Education Outreach (CEEO) is our partner for product development, workshops and conferences. In addition, local support is provided by our trade partners. If you are interested in a competitive challenge, check our website to fi nd out more about the FIRST LEGO LEAGUE.
    [Show full text]
  • A Zipliner's Delight
    A Zipliner’s Delight Subject Area(s) Physical Science, Science and Technology Associated Unit Yellow highlight = required component Associated Lesson Activity Title A Zipliner’s Delight Figure 1 ADA Description: Caption: Figure 1: Zipline robot basic assembly and components Image file: figure_1.tiff Source/Rights: Wikimedia Commons (left) Copyright © 2011 Polytechnic Institute of NYU. Grade Level 06 (05-07) Activity Dependency Time Required 2x(40-60 minutes) Group Size Expendable Cost per Group US$___ Summary Students learn about potential energy, as expressed as the height of an object along a linear on- dimensional zipline track. A robot, designed to traverse the track, converting stored potential energy into kinetic energy, also is capable of monitoring the instantaneous speed of the robot using various sensors. Thus, students are able to quantify and compare the starting potential energy (height) of a robot and the conversion thereof into kinetic energy (linear displacement). The system that is presented is that of a single robot, which is built using the LEGO Mindstorms robotics platform and installed with Lejos 0.9 firmware. Engineering Connection Engineering Category = #2 Keywords speed, potential energy, kinetic energy, robot, data collection Educational Standards Choose from http://www.jesandco.org/asn/viewer/default.aspx. ITEEA (provide standard number, grade band, benchmark letter and text): State/national science/math/technology (provide source, year, number[s] and text): NY Science Standard 1.2 Scientific Inquiry NY Science Standard 6.2 Models Pre-Requisite Knowledge Teacher should be familiar with LEGO NXT Mindstorms as a building and programming platform. Knowledge of pairing NXT Intelligent Bricks via Bluetooth is necessary.
    [Show full text]
  • Educational Hands-On Testbed Using Lego Robot for Learning Guidance, Navigation, and Control ?
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Loughborough University Institutional Repository Educational hands-on testbed using Lego robot for learning guidance, navigation, and control ? Seungkeun Kim, Hyondong Oh ∗ Amir Kolaman ∗∗ Antonios Tsourdos, Brian White ∗ Hugo Guterman ∗∗∗ ∗ Autonomous Systems Group, Dept of Informatics and Systems Engineering, Cranfield University, Defence Academy of the UK, Swindon, SN6 8LA UK (e-mail: s.kim@ cranfield.ac.uk, h.oh@cranfield.ac.uk, a.tsourdos@cranfield.ac.uk, b.a.white@cranfield.ac.uk) ∗∗ Department of Electro Optical Engineering, Ben Gurion University of the NEGEV, P.O.B 653 84105 Beer Sheva, Israel, (e-mail: [email protected]) ∗∗∗ Department of Electric Engineering, Ben Gurion University of the NEGEV, P.O.B 653 84105 Beer Sheva, Israel, (e-mail: [email protected]) Abstract: The aim of this paper is to propose an educational hands-on testbed using inexpensive systems composed of a Lego Mindstorms NXT robot and a webcam and easy-to-deal-with tools especially for learning and testing guidance, navigation, and control as well as search and obstacle mapping, however the extendibility and applicability of the proposed approach is not limited to only the educational purpose. In order to provide navigation information of the Lego robot in an indoor environment, an vision navigation system is proposed based on a colour marker detection robust to brightness change and an Extended Kalman filter. Furthermore, a spiral-like search, a command-to-line-of-sight guidance, a motor control, and two-dimensional Splinegon approximation are applied to sensing and mapping of a complex-shaped obstacle.
    [Show full text]
  • Experiences with the LEGO Mindstorms Throughout The
    Session T2F Experiences with the LEGO MindstormsTM throughout the Undergraduate Computer Science Curriculum Daniel C. Cliburn Assistant Professor of Computer Science Hanover College Hanover, Indiana 47243 [email protected] Abstract - The LEGO Mindstorms Robotics Invention the Mindstorms sections were actually less likely to declare a Systems are contemporary learning tools that have been major in computer science than those in the traditional used in a number of courses throughout the sections. The author of this paper has used the Mindstorms in undergraduate Computer Science curriculum. However, several undergraduate computer science courses with a mix of with a few exceptions, very little information is available success and failure. The purpose of this paper is to provide describing the degree to which Mindstorms projects what the author feels is missing from the literature: an improved (or hindered) the learning process in these informal discussion of the types of projects and courses for courses. This paper describes personal experiences and which the Mindstorms can be effective teaching tools, and provides practical advice for successfully incorporating those courses in which the Mindstorms should not be used. Mindstorms projects into an undergraduate computer The next section of this paper describes the efforts of science course, as well as highlighting the types of other instructors who have incorporated the Mindstorms into assignments that have not worked well. Specifically, the their courses. Following this discussion, the paper will author has incorporated Mindstorms projects into five describe the author’s own experiences with the Mindstorms in courses: Fundamental Concepts of Computer Science (a a number of classroom settings, and comment on their non-major Computer Science course), Programming I, usefulness as teaching tools in these courses.
    [Show full text]
  • Environment Mapping Using the Lego Mindstorms NXT and Lejos NXJ
    Environment Mapping using the Lego Mindstorms NXT and leJOS NXJ Gerardo Oliveira 1, Ricardo Silva 1, Tiago Lira 1, Luis Paulo Reis 1,2 1 FEUP – Faculdade de Engenharia da Universidade do Porto, Portugal 2 LIACC – Laboratório de Inteligência Artificial e Ciência de Computadores da Universidade do Porto, Portugal Rua Dr. Roberto Frias, s/n 4200-465 Porto, Portugal {ei04106, ei03087, ei04085, lpreis}@fe.up.pt Abstract. This paper presents a project of simultaneous localization and mapping (SLAM) of an indoor environment focusing on the use of autonomous mobile robotics. The developed work was implemented using the Lego Mindstorms NXT platform and leJOS NXJ as the programming language. The NXJ consists of an open source project which uses a tiny Java Virtual Machine (JVM) and provides a very powerful API as well the necessary tools to upload code to the NXT brick. In addition, the leJOS NXJ enables efficient programming and easiness of communication due to its support of Bluetooth technology. Thus, exploiting the mobile robotics platform flexibility plus the programming language potential, our goals were successfully achieved by implementing a simple subsumption architecture and using a trigonometry based approach, in order to obtain a mapped representation of the robot's environment. Keywords: Lego Mindstorms, NXT, leJOS, NXJ, Java, Robotics, Mapping, Subsumption Architecture, Behavior-Based, Client-Server. 1 Introduction One of the major problems in the field of robotics is known as SLAM (Simultaneous Localization and Mapping) [3], consisting of a technique used by robots and autonomous vehicles to build up a map within an unknown environment while at the same time keeping track of their current position.
    [Show full text]
  • Cult of Lego Sample
    $39.95 ($41.95 CAN) The Cult of LEGO of Cult The ® The Cult of LEGO Shelve in: Popular Culture “We’re all members of the Cult of LEGO — the only “I defy you to read and admire this book and not want membership requirement is clicking two pieces of to doodle with some bricks by the time you’re done.” plastic together and wanting to click more. Now we — Gareth Branwyn, editor in chief, MAKE: Online have a book that justifi es our obsession.” — James Floyd Kelly, blogger for GeekDad.com and TheNXTStep.com “This fascinating look at the world of devoted LEGO fans deserves a place on the bookshelf of anyone “A crazy fun read, from cover to cover, this book who’s ever played with LEGO bricks.” deserves a special spot on the bookshelf of any self- — Chris Anderson, editor in chief, Wired respecting nerd.” — Jake McKee, former global community manager, the LEGO Group ® “An excellent book and a must-have for any LEGO LEGO is much more than just a toy — it’s a way of life. enthusiast out there. The pictures are awesome!” The Cult of LEGO takes you on a thrilling illustrated — Ulrik Pilegaard, author of Forbidden LEGO tour of the LEGO community and their creations. You’ll meet LEGO fans from all walks of life, like professional artist Nathan Sawaya, brick fi lmmaker David Pagano, the enigmatic Ego Leonard, and the many devoted John Baichtal is a contribu- AFOLs (adult fans of LEGO) who spend countless ® tor to MAKE magazine and hours building their masterpieces.
    [Show full text]
  • Lego Mindstorms Segway Project
    AGH - UNIVERSITY OF SCIENCE AND TECHNOLOGY Lego Mindstorms Segway Project Authors of project: Łukasz Bondyra, Paweł Górka, Jakub Tutro, Krzysztof Wesołowski Under the supervision of: Adam Piłat Ph.D. Documentation drawn up by: Łukasz Bondyra WEBSITE: http://home.agh.edu.pl/~ap/segway 2009-04-20 Lego Mindstorms Segway Project Basic Lego Mindstorm project was inspired by Yorihisa Yamamoto. It was developed in the academic research club INTEGRA, working in the Electrical faculty in the AGH – University of Science and Technology. The Lego Mindstorms project is part of the bigger one, which aims to create a Segway human transporter machine. The following works were made: I. Installation of necessary software. All applications need to be installed/extracted to non – space directories. 1. Cygwin 1.5.25-15 - a Linux - like environment for Windows which enables to run some Linux applications in Windows environment. It includes GCC compilator. INSTALATION: Devel Default -> “make: The GNU version of the ‘make’ utility” must be marked. IMPORTANT: Cygwin has to be 1.5.x or newer version. WEBSITE: http://www.cygwin.com 2. GNU ARM toolchain 4.0.2 - a distribution of GCC (GNU Compiler Collection) for ARM core which supports an ARM7 CPU in the NXT INSTALATION: “Floating point unit” doesn’t have to be marked IMPORTANT: Using other version of GCC may cause unexpected errors. WEBSITE: http://www.gnuarm.com/bu-2.16.1_gcc-4.0.2-c-c++_nl-1.14.0_gi-6.4.exe 3. MINDSTORMS NXT Driver v1.02 - This software installs/updates the LEGO MINDSTORMS NXT driver, which enables windows to recognize the NXT.
    [Show full text]
  • LEGO MINDSTORMS NXT Programming
    LEGO MINDSTORMS NXT Programming Bernhard Buchli Andreas Schranzhofer Bernhard Buchli, [email protected], ETZ G 75, +41 44 63 27038 Andreas Schranzhofer, [email protected], ETZ G 77, +41 44 63 20454 09/29/10 Andreas Schranzhofer / Bernhard Buchli 1 NXT Tutorial ± Outline . Software Installation . get the USB ± Stick Folder ¹PPSª . "Hello World!" on NXT . ¹Sensor and Motorª on NXT . References, Documents, Links 09/29/10 Andreas Schranzhofer / Bernhard Buchli 2 Software Installation . NXT connects via USB (or Bluetooth) to PC . Driver available at: http://mindstorms.lego.com/support/updates/ . Programming Environments . Mindstorms NXT Software . Robolab (LabVIEW) . Lejos, RobotC, BricxCC) . Default: BricxCC http://bricxcc.sourceforge.net/ 09/29/10 Andreas Schranzhofer / Bernhard Buchli 3 Starting BricxCC . Connect NXT to the PC . Turn on NXT . Pop-Up Dialog Properties: . port: USB . brick type: NXT . firmware: Standard 09/29/10 Andreas Schranzhofer / Bernhard Buchli 4 Hello World! . C-like programming language: NXC (Not Excactly C) . The obligatory "Hello Worldª: #include "NXCDefs.h" task main() { ClearScreen(); PlayTone(440, 200); TextOut(0, LCD_LINE3, "Hello World!"); Wait(1000); PlayTone(440, 200); Wait(200); } 09/29/10 Andreas Schranzhofer / Bernhard Buchli 5 Compile Upload 09/29/10 Andreas Schranzhofer / Bernhard Buchli 6 The LEGO NXT 09/29/10 Andreas Schranzhofer / Bernhard Buchli 7 Sensor and Motor #include "NXCDefs.h" #define SPEED 70 task main() { int touch; SetSensor(S1, SENSOR_TOUCH); while (true) { touch = SENSOR_1; if (touch == 1) { OnFwd(OUT_A, SPEED); } else { Off(OUT_A); } } } 09/29/10 Andreas Schranzhofer / Bernhard Buchli 8 Mindstorms NXT Software 09/29/10 Andreas Schranzhofer / Bernhard Buchli 9 Lego Digital Designer 09/29/10 Andreas Schranzhofer / Bernhard Buchli 10 Mike©s Lego Cad 09/29/10 Andreas Schranzhofer / Bernhard Buchli 11 References .
    [Show full text]
  • Lego Mindstorms: an Mbeddr Case Study
    Lego Mindstorms: an mbeddr Case Study Markus Voelter1 and Bernd Kolb2 1 independent/itemis 2 itemis Abstract. This case study looks at the first large-scale demo case built with mbeddr: a set of C extensions for programming Lego Mindstorms robots. We have developed several robots (and the respective software) based on a common set of C extensions. Since C-based Mindstorms pro- gramming is based on the OSEK operating system, this case study has relevance beyond Lego. Last Changed: Feb 1, 2012 1 Contacts for more Info The Lego Mindstorms case study has been developed by the mbeddr team, in par- ticular Bernd Kolb ([email protected]) and Markus Voelter ([email protected]). 2 What is the problem/domain your system addresses? Lego Mindstorms provides the ability to program lego models. The system comes with an ARM processor and a number of sensors and actuators to build various kinds of computer-controlled machines. The software can be written in various ways, from a visual programming language provided by Lego, a version of Java, as well as C. In this case study we use the C-based way of programming mindstorms. The C-based way of programming Mindstorms is based on the OSEK oper- ating system . OSEK is used a lot in automotive embedded software, which is why this case study is relevant beyond Lego. The OSEK implementation used for Mindstorms in Lejos OSEK . 3 Why was mbeddr/MPS chosen as the basis? mbeddr was used as the basis because this case study was explicitly intended to be an mbeddr demo.
    [Show full text]
  • PROJECT No 1: LEGO SEGWAY Or Legway Build Your Own Legway!
    PROJECT No 1: LEGO SEGWAY or LegWay Build your own LegWay! You can find many self balancing NXT robots on the web, but what does it take to make your own Segway? This page won't tell you all the details about self balancing robots, but instead it provides simple step-by-step instructions to creating your own Segway. What will you make? You can create your own LegWay (shown above) during this block week course and program it to move, avoid obstacles and keep its balance. It should balances on two wheels as it drives around any flat hard surface (even sloped surfaces) while avoiding walls and other objects. What do you need? • The HiTechnic Gyro Sensor • A MINDSTORMS NXT set • The programming software that comes with your NXT set The LegWay can be built with Any NXT set. Whether you have You can build the segway with the NXT #8527 set, the NXT 2.0 #8547 , or even the NXT this set plus a Gyro Sensor Education #9797, you can build the Anyway with just the pieces you have. The same goes for the programming software: it doesn't matter which version you have. Building the LegWay Once you've collected everything you need, you are ready to build your LegWay. Follow the figures below and follow the step-by-step building instructions. Make sure that you carefully connect the cables as shown. STEP No. 1: STEP No. 2: STEP No. 3: STEP No. 4: STEP No. 5: STEP No. 6: STEP No. 7: Loading the program The final task if for you to program the robot to behave as expected (i.e., balance on two wheels as it drives around any flat hard surface, and avoids walls and other objects).
    [Show full text]