[Low-level] Programming of NXT Robots Pavel Petrovič Department of Applied Informatics, Faculty of Mathematics, Physics and Informatics

Slides:



Advertisements
Similar presentations
1chung 5 th Annual Robofest 2004 Informational Meeting Mar. 20, 2004 Chan Jin Chung Ali Khazaal Jason Lo Computer Science Lawrence Technological University.
Advertisements

Exercise 1: Install PC Software & NXT Firmware
Lego Mindstorms and NXT-G Magnus Eriksson, Mid Sweden University 2012 Based on a presentations by National Instruments and Pavel Petrovič.
LabView Basics.
Robotics Invention System 2.0
Why robotics in Education? DEI The University of Padova.
Computer Basics. The Computer (Generic) Processor executes commands. Memory stores program and data. Input devices transfer information from outside world.
Alternative Programming Languages Myles McNally LMICSE Workshop November , 2004 University of Mississippi.
Lego RCX Assembler and a Case Study Luis Paris Dept. of Computer Science University of Mississippi.
Building robots Spring Mindstorms Programming Java + leJOS, NQC, and others.
CSE Design Lab – Milestone 2 James Hopkins Dave Festa Dennis O’Flaherty Karl Schwirz.
Introduction to Lego Mindstorms LMICSE Workshop June , 2005 Alma College.
Not Quite C: A CS 0 Option LMICSE Workshop June , 2005 Alma College.
Systems Programming Course Gustavo Rodriguez-Rivera.
LEGO Mindstorms Hitachi H8-based RCX brick B.A. Juliano, R.S. Renner, F. Jauregui January 2004 California State University, Chico Intelligent Systems Laboratory.
The NXT is the brain of a MINDSTORMS® robot. It’s an intelligent, computer-controlled LEGO® brick that lets a MINDSTORMS robot come alive and perform.
Xander Soldaat BotBench.com. Topics  What is Mindstorms?  How can you build with it?  What can you build with it?  Programming the NXT  What’s inside.
Lego Mindstorms NXT 2.0 Presented By: Fatma Al-Qattan Haya Al-Hajri Fatma Baqer Hanan Al-Qabandi.
Remote robot control using mobile devices Andrey Litvinov Evgenia Samochadina Renat Valeev.
Using the LEGO NXT March 2007 David Schilling Gus Jansson.
A short demonstration of the Robotics course Simos Anagnostakis University of Crete, Crete, Mobilim Conference.
Teaching with Robotics Professor: Jeffrey Forbes
LEGO Mindstorms NXT Introduction. Component NXT Brick Touch Sensor Light Sensor Ultrasonic Sensor Interactive Servo Motors MMN Lab.
Program your NXT robot with Imagine Pavel Petrovič IDI NTNU, Trondheim
ECE 191: Group 2 NXT Robots & Their Applications in Machine Learning Mentor: Anjum Gupta Group: Roanne Manzano Eric Tsai Jacob Robison Sponsored by: SPAWAR.
Department of Computing and Information Sciences Kansas State University Design Methodology for State based Embedded Systems Case Study: Robot Controller.
Demonstrating the Capabilities of MindStorms NXT for the AI Curriculum Myles McNallyFrank Klassner Alma CollegeVillanova University AAAI Spring Symposium.
Computer Science, Software Engineering & Robotics Workshop, FGCU, April 27-28, 2012 Nicholas Alteen Evan McKeon Michael Humphries Computer Science Program.
Adapted for STLP Camp ‘09 Mobile Robots Why do robots need to move?
Why do robots need to move?
 Ahmed Khawaja: Microcontroller  Jonathan Limpalair: Construction  Bryan Mason: Microcontroller  Jesse Mccall: Editor, UI  David Pesa: Construction.
CSCI 394© 2007 JW Ryder1 NXC Information  Not eXactly C  very similar to NQC  Currently has more NXT API supported than LeJOS NXJ   Uses.
Robotics Overview of NXT-G Actuators in Mindstorms. Touch sensor Labwork: Right turn. Touch/bump. [Explore move versus Motor Move mini & motor mini. Motor*.]
Use bluetooth for communication 1. enable bluetooth in NXT and also enable visibility 2. configure setting in brickCC –Wait about 30 seconds for searching.
Final Presentation.  Software / hardware combination  Implement Microsoft Robotics Studio  Lego NXT Platform  Flexible Platform.
AUTOMATION & CONTROL INSTITUTE INSTITUT FÜR AUTOMATISIERUNGS- & REGELUNGSTECHNIK Utilizing Lego Mindstorms nxt(tm) as Teaching and Training Platform for.
CS 3131 Introduction to Programming in Java Rich Maclin Computer Science Department.
NXC (and NBC) NXC (Not eXactly C) is a language similar to NQC, which was the most popular way to program the RCX Built on NBC, the Next Byte Code ‘assembler’
Department of Computing and Information Sciences Kansas State University Design Methodology for State based Embedded Systems Case Study: Maze Navigator.
Overview: The goal of this lesson is to transition from discussing robots in general to the specifics of NXT robot. Objectives: Students will be able.
SLego: A Squeak Implementation of Lego Mindstorms Alexandre Bergel Institut fuer Mathematik und Informatik University Bern
THE TOUCH SENSOR The Touch Sensor, shown in the picture, gives the robot the sense of touch. It gives too different signals when the orange part is ether.
Girls’ Robotics Camp Spring Welcome! What are we learning? –Robotics –Application of Robotics –Programming –Out-of-the-box Thinking Let’s have Fun!
NQC / BricxCC Brief Introduction David Schilling.
How to control LEGO® Mindstorms devices Thomas Mueller thomas _ tmspecial.com.
Minds and Computers 2.1 The RCX l Hitachi H8/3297 series processor l 3 inputs/sensors (1, 2, 3) l 3 outputs/motors (A, B, C) l 32k RAM/ 16k ROM ä 12 kB.
Mindstorms 1.1 Today’s topics l AI l History of Robotics l Uses of robots l The RCX l ROBOLAB l Upcoming ä Basic control ä Kinematics ä Robot architectures.
Robot Dance based on Online Automatic Rhythmic Perception João M. Lobato D. S. Oliveira In cooperation with: LIACC Laboratório de Inteligência Artificial.
Software Toolchains. Instructor: G. Rudolph, Summer Motivation Desktop Programmers typically write code on the same kind of machine on which it.
ATI LEGO ROBOLAB Steps To Getting Started. ROBOLAB Introduction  Robots are built around the RCX programmable LEGO brick that is used to control motors.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
ROBOTICS Jason Bell Brad Carlson
DPS Secondary Science Institute 1 Agenda 8:30-8:45 Introduction and Overview 8:45-9:15 The Bumper Car 9:15-10:15 The Line Follower 10:15-10:30 Questions.
Lego Mindstorm Robots 9797 kit.  Students will learn how to identify how to detect a change in a condition.  Students will learn where and how to identify.
機器人教學成長社群 2014/10/1 Lego EV3 Compatible Software.
Spring 2008 Mark Fontenot CSE Honors Principles of Computer Science I Note Set 11.
Overview: This lesson explores the NXT as a computer. It is intended to follow the "Introduction to Computers" lesson. Objectives: Students will be able.
Introduction to LEGO Mindstorms EV3 What is in the box?
ARM from NXT NXC Programming
NXT Mindstorms Kit Programming
Instructor: Chien-Ho Ko
Introduction To Programming with LEGO NXT 0
Introduction To Programming with LEGO NXT 2
Introduction to NXT.
Robot Programming Computer Literacy S2.
Lego EV3 Mindstorms SW Programming Blocks.
Getting the software Install Fantom driver
LEGO Mindstorms Robot and Java
LEGO MINDSTORMS NXT PROGRAMMING
Presentation transcript:

[Low-level] Programming of NXT Robots Pavel Petrovič Department of Applied Informatics, Faculty of Mathematics, Physics and Informatics July 9 th 2008

2 Welcome to world of LEGO LEGO Geometry Low-level Programming of NXT robots, July 9 th 2008

3 You can build everything... Low-level Programming of NXT robots, July 9 th 2008

4 Programmable LEGO Manually programmable module in 1990 Low-level Programming of NXT robots, July 9 th 2008

5 Programmable LEGO TECHNIC Control Center 1993 Low-level Programming of NXT robots, July 9 th 2008

6 Programmable LEGO Control Lab Building Set 1995 Low-level Programming of NXT robots, July 9 th 2008

7 Programmable LEGO Code Pilot: programmed by sweeping barcodes (1997)‏ Low-level Programming of NXT robots, July 9 th 2008

8 Programmable LEGO LEGO Mindstorms RCX (1998)‏ 8-bit microcontroller Hitachi H8/300, 32kb RAM AUTONOMOUS Excellent tool for teaching basics of robotics, embedded systems, etc. at all levels Low-level Programming of NXT robots, July 9 th 2008

9 Programming RCX Robotics Invention System – event based, icons, visual, educational RoboLab – educational, visual, flow-chart based NQC – C-like language translated to bytecodes Lejos – Java-like language BrickOS – GNU C/C++ compiler – produces fast binary code, full flexibility of C language Many others... Low-level Programming of NXT robots, July 9 th 2008

10 LEGO Mindstorms NXT (2006)‏ 32-bit ARM7 microcontroller AT91SAM7S KB Flash 64 KB RAM BlueTooth, USB, I2C, high speed IEC Type 4/EN x 64 graphical LCD, better sensors, motors Programmable LEGO Low-level Programming of NXT robots, July 9 th 2008

11 Built-in rotation sensors NXT Motors Low-level Programming of NXT robots, July 9 th 2008

12 Much stronger NXT Motors Low-level Programming of NXT robots, July 9 th 2008

13 Light sensor NXT Sensors Low-level Programming of NXT robots, July 9 th 2008

14 Touch sensor NXT Sensors Low-level Programming of NXT robots, July 9 th 2008

15 Sound sensor NXT Sensors Low-level Programming of NXT robots, July 9 th 2008

16 Ultrasonic distance sensor NXT Sensors Low-level Programming of NXT robots, July 9 th 2008

17 NXT Non-standard sensors: HiTechnic.com Low-level Programming of NXT robots, July 9 th 2008 Compass, Accellerometer, Gyroscope, Color, IRSeeker, …

18 Master-slave: only master initiates communication Master can connect up to 3 slaves Optional acknowledgement, request reply Mailboxes #1-10 Sending:  Master: NXTCommBTWrite(slave, mailbox)‏  Slave: NXTMessageWrite(mailbox)‏ Receiving: both sides NXTMessageRead()‏ Unreliable & Quite complex, but does not block NXT BlueTooth Protocol Low-level Programming of NXT robots, July 9 th 2008 Silvian Toledo:

19 Programming NXT Low-level Programming of NXT robots, July 9 th 2008

20 Programming NXT Low-level Programming of NXT robots, July 9 th 2008

21 Programming NXT Low-level Programming of NXT robots, July 9 th 2008

22 Standard Software NXT-G Low-level Programming of NXT robots, July 9 th 2008

23 LEGO Digital Designer ldd.lego.com Low-level Programming of NXT robots, July 9 th 2008

24 Not eXactly C (NXC) Low-level Programming of NXT robots, July 9 th 2008 Derivative of NQC for RCX by John Hansen BricX IDE Excellent tools and features C-like language with good documentation NXT Power Programming book

25 NXC example: line-following Low-level Programming of NXT robots, July 9 th 2008 int s; task main()‏ { SetSensorType(S1, SENSOR_TYPE_LIGHT_ACTIVE); SetSensorMode(S1, SENSOR_MODE_PERCENT); ResetSensor(S1); while (1) { if (Sensor(S1) < 48) { OnFwd(OUT_A, 75); Float(OUT_C); } else { OnFwd(OUT_C, 75); Float(OUT_A); } }

26 Java programming for NXT Low-level Programming of NXT robots, July 9 th 2008 iCommand – direct command mode Lejos  Object oriented language  Preemptive threads  Arrays, including multi-dimensional  Recursion  Synchronization  Exceptions  Java types including float, long, and String  Most of the java.lang, java.util and java.io classes  A Well-documented Robotics API

27 NXT Logo Low-level Programming of NXT robots, July 9 th 2008 Combines the power of educational programming language Logo with robots wiki.robotika.sk/index.php/Logo_for_NXT 1. Interactive Imagine Logo project 2. Loadable imagine library (nxt.imt) 3. Interpreter of Logo 4. Stand-alone

28 NXT Logo example: line-following Low-level Programming of NXT robots, July 9 th 2008 to "follow [] [ setsensor motor 0 "onrev 40 while ["true] [ while [ge? sensor 3 59] [] motor 0 "float 0 motor 2 "onrev 40 wait 50 while [lt? sensor 3 60] [] motor 2 "float 0 motor 0 "onrev 40 ]

29 Issues of the standard firmware Low-level Programming of NXT robots, July 9 th 2008 Limited multi-tasking Complex motor model Simplistic memory management Not suitable for development of tools Design your own firmware! NXT GCC project Approach: Take the standard firmware and modify it

30 Architecture of Standard Firmware Low-level Programming of NXT robots, July 9 th 2008 Scheduler + modules Each module:  Init()‏  Ctrl()‏  Exit()‏ Scheduler periodically calls Ctrl() on all the modules Method1: design a new module Method2: call your code from Ctrl() function of some module Programming Concept: STATE MACHINE

31 Modifying standard firmware Low-level Programming of NXT robots, July 9 th 2008 cUiMenuCallFunction(Function,Parameter) is called when user presses button to trigger various functions, set a global flag: if ((Function == 8) && (Parameter == 248)) run_example = 1; In cCmdCtrl(void), check the global flag: if (run_example) example(); Implement the example() function as state machine All standard functions available + direct C coding!

32 Low-level Programming of NXT robots, July 9 th 2008 void example()‏ { static int example_state = 0; static ULONG x; if (example_state == 0) { cDebugString2("example", 0, 5); dOutputSetSpeed(1, MOTOR_RUN_STATE_RUNNING, 75, 1); x = dTimerRead(); example_state ++; } else if (example_state == 1) { if (dTimerRead() - x > 1000) example_state = 2; } else if (example_state == 2) { dOutputSetSpeed(0, MOTOR_RUN_STATE_IDLE, 0, 0); cDebugString2("done", 0, 5); example_state = 0; run_example = 0; }

33 Sources of Information Low-level Programming of NXT robots, July 9 th 2008 LEGO Official documentation  NXT Firmware Open Source  Software Developer Kit (SDK)  Hardware Developer Kit (HDK)  Bluetooth Developer Kit (BDK) HiTechnic.com LUGNET.com

34 Workshop Low-level Programming of NXT robots, July 9 th 2008 Today & tomorrow afternoon 7 NXT bricks available Hands-on creative exercise Build and program the robot in your favourite environment, preferably modify the firmware Welcome & Thank you for the attention