Using the LEGO NXT March 2007 David Schilling Gus Jansson.

Slides:



Advertisements
Similar presentations
Exercise 1: Install PC Software & NXT Firmware
Advertisements

BEST Robotic, Inc. easyC Team Training
Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
LabView Basics.
Motors, Sensors, and Samantha SSI Robotics September 7, 2013 Capitol College.
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Mine Mapping Remote Communication.
VEX Robotics Platform and ROBOTC Software Introduction.
Computer Basics. The Computer (Generic) Processor executes commands. Memory stores program and data. Input devices transfer information from outside world.
Introduction to Lego Mindstorms LMICSE Workshop June , 2005 Alma College.
Aztec PC Scope Preliminary Design Review Fall 2006 Michael MasonJed Brown Andrew YoungsJosh Price.
Microcontrollers Lecture L12.2 Section Microcontrollers Microcontrollers vs. Microprocessors Two standard architectures PIC microcontroller 68HC12.
ECE 4220 Real Time Embedded Systems Final Project Presentation Spring 2014 University of Missouri Columbia By: Michael Brauch Temperature Data Logger.
LEGO Mindstorms Hitachi H8-based RCX brick B.A. Juliano, R.S. Renner, F. Jauregui January 2004 California State University, Chico Intelligent Systems Laboratory.
Embedded Computing Overview Dr. Curtis Nelson Engr355 – Embedded Systems Design Walla Walla University.
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.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
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.
2008 – 2009 Team Unlimited (FTC # 1) Coding for the FIRST Tech Challenge NXT/G, LabVIEW & RobotC compared, and a Crash Course in RobotC Presented by Team.
The 6713 DSP Starter Kit (DSK) is a low-cost platform which lets customers evaluate and develop applications for the Texas Instruments C67X DSP family.
VEX Robotics Platform and ROBOTC Software
Embedded Microcomputer Systems Andrew Karpenko 1 Prepared for Technical Presentation February 25 th, 2011.
ECE 191: Group 2 NXT Robots & Their Applications in Machine Learning Mentor: Anjum Gupta Group: Roanne Manzano Eric Tsai Jacob Robison Sponsored by: SPAWAR.
[Low-level] Programming of NXT Robots Pavel Petrovič Department of Applied Informatics, Faculty of Mathematics, Physics and Informatics
Adapted for STLP Camp ‘09 Mobile Robots Why do robots need to move?
Introduction to the Basic Parts of LEGO’s NXT Robotics
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Disassemble NXT 1. Daughterboards Display daughterboard Connector to the motherboard that you can disconnect Bluetooth daughterboard Speaker on the display.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
The New FTC Platform (Connecting your legacy hardware)
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
BEST Robotic, Inc. easyC Breakout Session By: Guy Chetrit Programming With easyC September 15, Copyright © 2012 BEST Robotics, Inc. All rights reserved.
AUTOMATION & CONTROL INSTITUTE INSTITUT FÜR AUTOMATISIERUNGS- & REGELUNGSTECHNIK Utilizing Lego Mindstorms nxt(tm) as Teaching and Training Platform for.
A tiny turtle robot DEI The University of Padova.
The George Washington University Department of ECE ECE 1010 Intro: Electrical & Computer Engineering –Introducing KIPR Link/Interface and Set-up –Continuation.
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’
NQC Brief Introduction – Part 3 David Schilling. NQC – Where is my data? Programs have 32 global variables Tasks have 16 local variables These are always.
VEX ARM® Cortex®- based Microcontroller. The VEX ARM® Cortex®-based Microcontroller coordinates the flow of all information and power on the robot. All.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
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.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
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.
Programming and Debugging with the Dragon and JTAG Many thanks to Dr. James Hawthorne for evaluating the Dragon system and providing the core content for.
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.
EV3 Hardware: Anything you can see or touch EV3 Software: Programs written by you Firmware: Programs/Instructions written by the manufacturer.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
ARM from NXT NXC Programming
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
2.8 NXT Test Programs (Try Me Mode) U2C8
NXT Mindstorms Kit Programming
Obstacle avoiding robot { pixel }
Exploring Computer Science Lesson 6-5
ROBOTC for VEX On-Site Professional Development
Introduction To Programming with LEGO NXT 0
‘SONAR’ using Arduino & ultrasonic distance sensor
Introducing KIPR Link/Interface and Set-up
Hardware, Software & Firmware
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Computer Communication
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Exploring Computer Science Lesson 6-5
Getting the software Install Fantom driver
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Introduction to Arduinos
LEGO Mindstorms Robot and Java
Presentation transcript:

Using the LEGO NXT March 2007 David Schilling Gus Jansson

Overview NXT Hardware Programming Languages Using the NXT Demo Robots

NXT – What you see 4 Inputs (digital & analog) 3 Outputs (support for encoders) Screen (100x64 pixels) 4 Buttons Sound USB and Bluetooth

Processors Main processor: Atmel 32-bit ARM processor, AT91SAM7S KB FLASH 64 KB RAM 48 MHz Co-processor: Atmel 8-bit AVR processor, ATmega48 4 KB FLASH 512 Byte RAM 8 MHz

Bluetooth and USB communication Bluetooth wireless communication CSR BlueCoreTM 4 v2.0 +EDR System Supports the Serial Port Profile (SPP) Internal 47 KByte RAM External 8 MBit FLASH 26 MHz USB 2.0 Full speed com port (12 Mbit/s)

Graphics, Sound, etc Display 100 x 64 pixel LCD black & white graphical display Loudspeaker Sound output channel with 8-bit resolution Sample rate of 2-16 KHz 4 Buttons

Misc. 3 output ports 6-wire interface supporting input from encoders 4 input ports 6-wire interface supporting I2C as well as analog 1 high speed port, IEC Type 4/EN compliant JTag debugging pins if you want them LEGO has released technical specifications for all this

Online Documentation - click on “NXTreme” button for information and downloads for advanced users Open source firmware!!! SDK – Software Developer Kit HDK – Hardware Developer Kit BDK – Bluetooth Developer Kit

Motors Biggest improvement over RCX – rotation counters built in 360 counts per rotation They are relative, not absolute positions Maximum speed is approx. 200 RPM Motors are much stronger than the other, older LEGO motors

Sensors Digital ultrasonic sensor (3cm-100cm) Light sensor – can control LED Sound sensor – DB and DBA Touch sensor - binary

Conversion cable LEGO has a conversion cable that allows you to use the sensors and motors of the RCX on the NXT And vice versa, but you can’t use the ultrasonic sensor on the RCX, and the motors won’t have encoder support

Wires The LEGO NXT wires have odd ends (like the DEC RJ-12 connector, but backwards) Wiring diagrams: Analog input

3 rd Party Sensors Prices from $30 to $50 (so far) HiTechnic ( Packaging like LEGO sensors Authorized by LEGO MindSensors ( Circuit boards with connectors

HiTechnic Sensors Color Sensor Compass Sensor Acceleration Sensor More coming… Prototype board Gyro sensor (analog, not I2C digital) IR Link (to talk to RCX and other LEGO IR devices) IR Seeker (for robo soccer, for example) No-contact touch sensor (electrostatic sensor) Motor Multiplexor Sensor Multiplexor

MindSensors Sensors Acceleration Sensor RCX to NXT communications link PS2 controller interface Motor Multiplexor Magnetic Compass Pneumatic Pressure Sensor

Bluetooth One way to download programs Can send files from one NXT to another Allows up to four NXTs to talk with each other One master, three slaves Can use a phone as a remote control for your NXT Other devices may be supported

Programming Languages NXT-G code NXC (and NBC) Robot C pbLua Java and others

NXT-G code LEGO’s development environment Graphical programming Based on National Instruments’ LabView Great for quick programs Wonderful for kids to use … but a real pain for old geezers like me who grew up with text programming languages

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’ Uses the built in firmware, and p-code system

NXC uses BricxCC Reasonably stable development environment Provides support for all LEGO robotic platforms Free!

Robot C Carnegie Mellon’s programming language for various robotic platforms (including VEX, RCX, as well as NXT) Requires new firmware Not free (free trial, $30 download)

pbLua New firmware, and language Small portable language for embedded systems By Ralph Hemple, the author of pbForth for the RCX Compiles on brick! Use any terminal device to talk to it

Other languages Java and several other languages are reportedly in the works as well MS Robotic Studio also supports the NXT Download a small client program to NXT Actual control is on a PC

Programming with NXC Assuming you are comfortable with C… How to use the motors How to read the sensors Threading model

NXC Programs NXC is based on C Restrictions because it’s based on the built-in P-Code system There’s no stack Limited memory Limited number of tasks (256) And subroutines, which are also ‘tasks’

NXC program skeleton #include "NXCDefs.h" task main() { }

NXC Sensors #include "NXCDefs.h" task main() { SetSensorType( IN_1, SENSOR_TYPE_TOUCH ); SetSensorMode( IN_1, SENSOR_MODE_BOOL ); }

NXC Sensors #include "NXCDefs.h" task main() { SetSensor( IN_1, SENSOR_TOUCH ); }

NXC Sensors To read a sensor use x = Sensor( IN_1 );

NXC Sample program #include "NXCDefs.h“ task main() { SetSensor( IN_1, SENSOR_TOUCH ); while( true ) { if( Sensor( IN_1 ) ) { PlayToneEx(440, 100, 3, false); TextOut( 0, LCD_LINE1, "TOUCHING!"); while( Sensor( IN_1 ) ) ; } TextOut( 0, LCD_LINE1, " "); while( !Sensor( IN_1 ) ) ; }

NXC Motors Simple motor commands are available OnFwd(), OnRev(), Off(), Float()

NXC Motors To use the built-in rotation sensors, you need to use the new motor commands Easiest to use is RotateMotor()

RotateMotor RotateMotor( port, speed, angle ); port is OUT_A, OUT_B, OUT_C, or combinations such as OUT_AB, OUT_ABC speed is a number -100 to 100 angle is the number of degrees you want the motor to turn (positive or negative)

Mimicking a Servo Motor Read the current motor angle Current = MotorRotationCount( OUT_A ); Calculate how far you need to turn Delta = Target – Current; Turn that amount RotateMotor( OUT_A, speed, Delta );

Displaying Text The LCD display is useful for Debugging Setting parameters Runtime messages Graphics Games … and more

Displaying Text TextOut( x, y, text ); NumOut( x, y, number );

LCD display The origin is the bottom left So TextOut( 0,0, “hi” ) will display in the bottom left corner Use the LCD_LINEn macros if you like to make it easier

Text Example y = 42; TextOut(0, LCD_LINE5, "Answer:" ); NumOut( 8*6, LCD_LINE5, y ); // characters are 6 pixels wide

Graphics There are also commands to draw lines, circles, rectangles, and set points You can display bitmaps from a file RIC files – contain drawing commands One problem is there isn’t an easy way to clear areas of the screen It’s easy to clear the whole screen You can display a 1x1 blank bitmap

Tasks and Subroutines Multiple tasks are possible, but don’t work like you might expect Scheduling is different – tasks start when a ‘dependant’ task finishes There is no easy way of stopping a task Use Precedes() or Follows() in a task to define task dependencies

Tasks task FooTask() { // will start executing when main() finishes } task main() { // program starts here Precedes( FooTask ); } task BarTask() { Follows( main ); // will also start executing when main() finishes }

Subroutines Essentially a task that can be called It suspends the calling task until it returns Don’t use task keyword to define these Can pass in parameters or return a value

Subroutine Example void TestSub( int x, int y, short i ) { x = y + i; } task main() { TestSub( 1, 2, 3 ); }

NXC Help Preliminary help file is a PDF There are many samples and a tutorial online

Demo Robots Dog 6-legged walker Crane Crate Dump truck Others?