LEGO Mindstorms Robot and Java

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

Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
Mini-SumoBot Construction and Programming
Vex Robotics Introduction to Sensors. introduction to sensors Sensors assist robots in seeing and feeling the physical world through which they travel.
Computer Basics. The Computer (Generic) Processor executes commands. Memory stores program and data. Input devices transfer information from outside world.
Building robots Spring Mindstorms Programming Java + leJOS, NQC, and others.
Introduction to Lego Mindstorms LMICSE Workshop June , 2005 Alma College.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Programming with Lejos Part 1. What is lejos? Cut-down version of Java for the RCX platform Includes: –Lejos API –JVM API includes functionality needed.
LEGO Mindstorms Hitachi H8-based RCX brick B.A. Juliano, R.S. Renner, F. Jauregui January 2004 California State University, Chico Intelligent Systems Laboratory.
1 ©2006 INSciTE Lab Two Task: Make the program from Lab One (Move forward 5 rotations and turn right 90 degrees) into a MyBlock.
A Short Introduction to JAVA
LEGO Mindstorms NXT Programming We will be using the Common Palette for our Robots This is how you download your program onto the brick Drag and drop a.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 1
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
// This is a simple control program Move forward 200 units Turn right 90 Move forward 100 units Turn right 45 Move forward 100 Turn right 45 Move forward.
Java: Chapter 1 Computer Systems Computer Programming II.
Introduction to Computer Systems and the Java Programming Language.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright
1 MIS 131 Introduction to Algorithms and Programming 2015/2016 Fall - Chapter 1 -
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
SLego: A Squeak Implementation of Lego Mindstorms Alexandre Bergel Institut fuer Mathematik und Informatik University Bern
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
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.
Oregon Robotics Tournament and Outreach Program RCX Basics.
1 Introduction to Java. 2 * 10% Assignments/ class participation * 10% Pop Quizzes * 05% Attendance * 25% Mid Term * 50% Final Term.
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.
Introduction to JAVA Programming
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Programming Design ROBOTC Software. Behavior-Based Programming A behavior is anything your robot does –Turning on a single motor or servo Three main types.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Overview: This lesson explores the NXT as a computer. It is intended to follow the "Introduction to Computers" lesson. Objectives: Students will be able.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Programming Design ROBOTC Software Principles Of Engineering
Introduction to LEGO Mindstorms EV3 What is in the box?
NXT Mindstorms Kit Programming
Exploring Computer Science Lesson 6-5
Branching Error (a.k.a. the VM Program Instruction Break Error)
JAVA MULTIPLE CHOICE QUESTION.
Outline Introduction What Is a Computer? Computer Organization
GC101 Introduction to computer and program
Chapter 1 Introduction to Computers, Programs, and Java
Chapter No. : 1 Introduction to Java.
Java on the LEGO Mindstorms EV3
An Introduction to Computers and Visual Basic
Introducing KIPR Link/Interface and Set-up
Java programming lecture one
An Introduction to Computers and Visual Basic
Introduction to LabVIEW
Chapter 1 Introduction to Computers, Programs, and Java
Module F: Presentation Understanding Robot Fundamentals
Robot Programming Computer Literacy S2.
Exploring Computer Science Lesson 6-5
Programming Design ROBOTC Software Principles Of Engineering
An Introduction to Computers and Visual Basic
LEGO Education - Mindstorms EV3 - Computer/control center – The Brick
Computer Programming-1 CSC 111
Lego MINDSTORMS EV3.
Programming Robots using Java
Oregon Robotics Tournament and Outreach Program
Programming Robots using Java
Presentation transcript:

LEGO Mindstorms Robot and Java Fall 2004

http://marsrovers. jpl. nasa. gov/mission/spacecraft_surface_rover http://marsrovers.jpl.nasa.gov/mission/spacecraft_surface_rover.html

Java as a Platform Sun Microsystem has different Java sizes (virtual machines sizes) for devices with different capabilities Java 2 Enterprise Edition (J2EE) for big machines Java 2 Standard Edition (J2SE) Java 2 Micro Edition (J2ME) designed for use with memory-constrained devices Mobile phones, pagers, PDA’s JavaCard which is 4KB

LEGO Mindstorms Robot Robot Kit includes: RCX (Robotics Command Explorer) 2 Motors 2 touch sensors 1 light sensor USB infrared transmitter tower A “gazillion” lego parts to build a robot

LEGO Mindstorms Robot Robotics Command Explorer (RCX) Small computer based on the Hitachi H8 microprocessor Equipped with: 16 Kb ROM 32 Kb RAM 3 motor ports for output 3 sensor ports for input 1 LCD display 1 sound unit 4 system timers 6 1.5V batteries IR port transmitter and receiver

LEGO Mindstorms Robot RCX runs on 6 AA batteries When batteries are low, battery icon with an “X” across it will appear in the display 3 gray ports labeled 1, 2, 3 Sensor ports 3 black ports labeled A, B, C Motor ports

LEGO Mindstorms Robot 4 buttons On-Off Run to executed and stop a loaded program Prgm to scroll through the loaded programs May load up to 5 programs at one time View allows you to view information on a sensor or motor

LEGO Mindstorms Robot Display Window A little person standing or running Indicates that a program is loaded or running respectively To the right of the little person, a number indicating which of 5 programs will be active when the Run program is pressed To the left of the little person, the Software Watch Shows program being downloaded. It counts units of 100 bytes, so a 3 Kb program counts up to ~ 30 Shows the voltage level of the battery

Programming the RCX Write a Java program in Eclipse using a LeJOS (LEGO Java Operating System) plug-in Compile the program transforming it into bytecode Download the program (bytecode) to the RCX using the IR tower Firmware interprets the bytecode converting it into machine code Processor executes the machine code

LEGO Java Operating System LeJOS is an open source project for UNIX-like and Win 32 systems Fully functional implementation of Java language Similar to Java 2 Micro Edition (J2ME) Originally developed by Jose Solorzano, but is now maintained by Paul Andrews and Jurgen Stuber

LEGO Java Operating System Limitations of LeJOS: No garbage collection – garbage collection reclaims memory taken up by objects that are not used in your program No switch statements; must use nested if….else No arithmetic on long data type Maximum array length is 511

LEGO Java Operating System Provides a Java package to control the RCX: josx.platform.rcx.* Provides Java classes for working with the RCX features: Motors Sensors Display Sound Buttons IR tower

LEGO Java Operating System TextLCD class: Uses the display to show text messages. This class uses a great deal of memory. The letters are approximations since the display was originally intended for numbers. public static final void print (String text) - prints the string text on the LCD. Only the first five letters are displayed. public static final void print (char [ ] text) - prints the first five characters of the text array on the display.

LEGO Java Operating System Motor class: Used to control the RCX output ports which control the motors. The class contains 3 static Motor instances, A, B, and C, which correspond to the 3 output ports. public final void setPower(int power) - sets the current power level of the motor from 0 to 7. public final void backward( ) - moves the motor backwards. public final void forward( ) - moves the motor forwards. public final void stop( ) - stops the motor. public final void reverseDirection( ) - no matter which way the motor is turning, it makes it turn the other way.

LEGO Java Operating System Button class: Encapsules 3 RCX buttons View, Prgm, Run. You may call a static instance of each button using VIEW, PRGM, and RUN. public void addButtonListener( ButtoneListener listener) - add a ButtonListener to this Button public final boolean isPressed( ) - returns true is the button is pressed, false otherwise public final void waitForPressAndRelease( ) throws InterrupedException - wait until the button is released

Let’s Try Create a simple program together that: Displays a word to the LCD Start one motor Run until the RUN button is pressed

You Try Add to the existing program: Start the other motor Play a descending arpeggio before the motors start

Robot Races Each team must program their robot to complete the race course. Your robot may not go outside the borders of the race course: Go forward Stop Turn 360 degrees to the right and display the message “RIGHT” Turn 360 degree to the left and display the message “LEFT” Play a sound for at least 10 seconds Go backward Go forward across the finish line