Java on the LEGO Mindstorms EV3

Slides:



Advertisements
Similar presentations
Getting started with LEGO NXT Mindstorms software This is intended to be a short introduction to the LEGO Mindstorms software and programming the LEGO.
Advertisements

Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
1 Mobile Computing Mobile First (formerly Worklight) Copyright 2015 by Janson Industries.
CSCI Spring '07© 2007 JW Ryder1 Week 2 Material  Install and Configure  Mindstorms NXT Software and User Guide  LeJOS NXJ Alpha  Java.
J2ME Programming. 2 Recommended Books Programming Wireless Devices with the Java2 Platform, Micro Second Edition (Paperback) by Roger Riggs (Editor),
How to make it work? Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
SET UP COMPUTER ** PLEASE BE AWARE SCREENSHOTS MAY NOT MATCH **
Getting Started with Android Programming Note: if you have already installed android development tools, please check that you have the same version as.
Android 4: Creating Contents Kirk Scott 1. Outline 4.1 Planning Contents 4.2 GIMP and Free Sound Recorder 4.3 Using FlashCardMaker to Create an XML File.
One to One instructions Installing and configuring samba on Ubuntu Linux to enable Linux to share files and documents with Windows XP.
Set up the Environment for leJOS NXJ. Required Software Software –JDK 1.6 –leJOS NXJ –USB driver for NXT Mindstorm nxt USB driver Libusb MMN Lab.
1 Mobile Computing Set Up Copyright 2015 by Janson Industries.
Introduction to Android. Android as a system, is a java based operating system that runs on the Linux kernel. The system is very lightweight and full.
Geo CE-XM ch 4 Edited 10/14/05 1 The XM is the newest of the rovers, and unlike other units, it comes with software installed on the unit as well as using.
Presented By: Muhammad Tariq Software Engineer Android Training course.
Booting Ubuntu Linux Live CSCI 130 – Fall 2008 Action Lab Dr. W. Jones.
EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright
9/2/ CS171 -Math & Computer Science Department at Emory University.
Setting Up Eclipse. What is Eclipse? Eclipse is a free, downloadable software that allows us to create, compile, and run JAVA programs.
Change in your CAD Project File - it happens all the time in robotics.
GumTree Development Environment Setup Windows Only Compatible with Eclipse 3.2 M3 (Last update: 16/11/05)
Liferay Installation Prepared by: Do Xuan Hai 8 August 2011.
How to Install the JDK (Java Development Kit) Click hereClick here to download the JDK.
Eclipse Project. Installing Visit to download a copy for your home computerhttp:// –Get Release version 3.0 (or.
Introduction to ev3dev: Setup
Using the BlueJ IDE with Mindstorms LMICSE Workshop June , 2005 Alma College.
How to Recover Deleted Photos from Android Cell Phone? Android is keeping on improving their products and make sure to provide the best software service.
Troubleshooting Dashhawk Issues. Here's what you have to do to have the DashHawk run properly Go to the ACTUAL PROGRAM file (not the short cut)
Full Review of Jihosoft Android Data Recovery
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Sentry System Two-Way Communication.
EV3 Hardware: Anything you can see or touch EV3 Software: Programs written by you Firmware: Programs/Instructions written by the manufacturer.
Clojure.  Follow instructions on lynda.com  Can install all this in other ways, but this is the easiest way to get a development environment working.
Day 1 Session 2. Setup & Installation
 There are three things to get Trend Micro software for your PC. They are Download, Installation and Activation of the software license. Trend Micro.
What are the Steps to add an HP Printer to a Mac Device? HP Customer Support Helpdesk.
After Construction Name: Per #:.
Tips for using Java with Internet Explorer
Introduction to LEGO Mindstorms EV3 What is in the box?
Installing Java on a Home machine
Introduction to Java Import Scanner class to use in our program
Exploring Computer Science Lesson 6-5
Chapter Objectives In this chapter, you will learn:
Obtaining the Required Tools
Module 2 Controlling a Lego EV3 Robot
Hardware, Software & Firmware
Creating a Media Server with a Raspberry Pi
CMPE 152: Compiler Design ANTLR 4 and C++
Windows Operating Systems (Cont.)
Close your computer first by clicking on the “Start” button and then press “Close” Wait 30 minutes Now, turn your computer back on and try connecting again.
GTS WebSocket General Guide
Installing Java on a Home machine
Introduction to EV3Dev: Setup with Python
Install Ruby If you are running on Mac OS X, Ruby is preinstalled.
How to Run a Java Program
Exploring Computer Science Lesson 6-5
Revision of Simple troubleshooting
Getting Started: Amazon AWS Account Creation
How to Run a Java Program
Configuration Of A Pull Network.
CS115 HOW TO INSTALL THE JAVA DEVELOPMENT KIT (JDK)
Download and Installation of code::blocks
Software Setup & Validation
Tonga Institute of Higher Education IT 141: Information Systems
Compiled from various Internet sources Presented by Mr. Hatfield
Tonga Institute of Higher Education IT 141: Information Systems
LEGO Education - Mindstorms EV3 - Computer/control center – The Brick
Review of Previous Lesson
Java Code Review with CheckStyle
Getting started with LEGO EV3 Mindstorms software
Downloading to the NXT requires the correct hardware setup
Presentation transcript:

Java on the LEGO Mindstorms EV3 Lecture 3 Java on the LEGO Mindstorms EV3

Objectives Install JDK 7 on your computer. Install leJOS on your computer and your EV3 brick. Intall leJOS Eclipse plugin. Set Eclipse preferences. Connect your EV3 to your computer. Download and run our first EV3 Java program.

Limitations of EV3 Software A big limitation of the EV3 programming is the difficulty in storing variables. As an example suppose we have the following situation: The Ultrasonic sensor has measured the distance to an obstruction (d). The robot has wheels with a known radius (r). How can we determine the number of wheel rotations to get within 2 cm of the obstruction? This is an easy math problem but it would be difficult (not impossible) to do this with the provided EV3 software. Any situation where we want to store and process data would be more easily handled using more traditional programming languages like C, Python or Java.

Hacking the Brick To install a new programming language on our EV3 it is necessary to install a new operating system. The EV3 actually already runs a version of Linux, but it is set up to hid the details and only present the “friendly” EV3 interface. We need to install a new version of Linux, one with a Java Virtual Machine. There are a couple of different packages we could use: EV3dev – this installs general Linux where you can add the language of your choice, Python, C, Java, etc. leJOS – this is a Java specific install

Installing leJOS on EV3 Installing leJOS basically consists of: Downloading some files Installing them in a very specific way on a micro SD card Adding a file to specify the IP number for the brick. Putting the SD card in the brick and restarting it. None of this is particularly hard but it is tedious. I will provide you with an appropriate SD card with leJOS already installed. Instructions on how to do this are available on the Wikispaces site.

Installing JDK 7 So that you can write and compile Java software for the EV3 using Eclipse, it is necessary to also install leJOS on your computer. First off you computer probably has Java 8 installed, but leJOS uses Java 7 so you will need to install the Java 7 development kit (JDK 7). Go to http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html and download the version of JDK 7 for your computer. Run the installer to put it on your system. You can have two different JDK packages at the same time so this should not replace JDK 8.

Installing leJOS on Your Computer Next you need to https://sourceforge.net/projects/lejos/files/lejos-EV3/ and download the source file leJOS_EV3_0.9.0-beta.tar.gz. Unpack this file in an appropriate directory. Inside the result you will find the file lejosimage.zip – decompress this file. That is it, leJOS is installed, but you still need to tell Eclipse how to use it.

Installing leJOS Plugin in Eclipse Next you need to install the leJOS plugin in Eclipse. Start Eclipse and select Help > Install New Software… Click the Add... Button.

Installing leJOS Plugin in Eclipse In the resulting dialog box type an appropriate name (like “leJOS EV3”) and the URL http://lejos.sourceforge.net/tools/eclipse/plugin/ev3 . Click OK.

Installing leJOS Plugin in Eclipse Now you should see leJOS EV3 Support as an option – select it and click Finish.

Set Eclipse Preferences Next you need to select Preferences in Eclipse and select leJOS. Enter the directory that resulted when you unpacked the downloaded leJOS file as EV3_HOME. Click the check box beside Connect to named brick and enter 192.168.1.1 as the name. Click Apply.

Set Eclipse Preferences While still in preferences, select Compiler. Set the Compiler compliance level to 1.7. Then click Apply and OK.

Connecting the Brick The brick needs to be connected to your computer. You can connect using a USB cable or using Bluetooth. If you want to use the include USB cable then plug the small end into the EV3 brick and the large end into a USB port on your computer. Bluetooth can be a little flaky so I would recommend the USB connection.

Renaming the Brick If you want to connect using Bluetooth, you will need to name your brick and then pair it with your computer. You need to pick a unique name for each brick so you can tell them apart. To name your brick you need to go to the System menu on the brick.

Renaming the Brick In the System menu go to Change Name. When you do this you will see the following on the screen.

Renaming the Brick You can select letters one by one. “U” on the bottom row gives you upper case letters. “l” gives you lower case letters. “x” deletes at letter. “D” signals you are done. In this example I changed the name of my brick to “Henry”. You will need to restart the brick after you complete the name change.

Pairing with Your Computer Once the brick restarts go to the Bluetooth menu.

Pairing with Your Computer Within the Bluetooth menu select Search/Pair.

Pairing with Your Computer On you computer do what you need to do to pair with a Bluetooth device. This is an example on a Mac.

leJOS HelloWorld If you are lucky everything should now work. Let’s try a simple program. Create a new project called EV3HelloWorld but this time create a LeJOS EV3 Project. Make sure the execution environment JRE is JavaSE-1.7.

leJOS HelloWorld Just as before add a HelloWorld class. You could run our previous HelloWorld.java program, but the text will disappear very quickly. We can add line to our code so that the EV3 will wait for a button press before exiting the program. Here is the new HelloWorld program.

leJOS HelloWorld This time we import a library that will give us access to methods to manipulate the EV3 hardware. import lejos.hardware.*; At the end of the program we add a call to a method to wait for a button press. Button.waitForAnyPress();

Running HelloWorld When you run your program the first time you must select what kind of application it is. This time it is a LeJOS EV3 Program.

Running HelloWorld In the console window you should see the following in the console pane.

Running HelloWorld On the EV3 you should see this.

Running HelloWorld Followed by this. The program will exit when you press a button.

What Could Go Wrong If the EV3 is not correctly connected to the computer, the console window will hang trying to download the program and will eventually time out. Check your settings: IP number BlueTooth – if you can’t get BlueTooth to work go to the USB cable. USB cable

What Could Go Wrong If your Java compiler is using JDK 8 the program will download correctly, but will crash the EV3. In this case you may need to go back to Eclipse preferences and select Compiler. This time you should click on Configure Project Specific Settings… You will need to select the settings for your leJOS project.

What Could Go Wrong Set the Compiler compliance level to 1.7. Try to run your program again.

Homework Get HelloWorld working on your EV3 brick.