This chapter provides step-by-step guidance on how to set up the environment for Java robotics programming with Lego Mindstorms EV3, including a basic overview of Lego Mindstorms EV3 and an introduction to leJOS EV3. The chapter covers how to install the leJOS EV3 development system onto your computer, how to install leJOS EV3 firmware into the Lego EV3 brick, and how to install and apply the leJOS EV3 plug-in for Eclipse IDE. Finally, you will create your first Java robotics program called HelloWorld , upload the HelloWorld program from your computer into the Lego EV3 brick through a USB cable, and execute the program on Lego Mindstorms EV3.
Introduction to Lego Mindstorms
Lego Mindstorms is an educational product from Lego designed to help you build robots easily. The product series has been evolving for decades, and Lego Mindstorms EV3 is the third generation. Figure illustrates a typical Lego Mindstorms EV3 robotics set in which the EV3 brick is the brain of Lego Mindstorms EV3. It is an intelligent, programmable device that lets a Lego robot perform various intelligent operations .
Figure 1-1.
Lego Mindstorms EV3
As illustrated in Figure .
The motor ports included in Lego Mindstorms EV3 have four output ports for attaching motors: Ports A, B, C, and D.
Sensor Ports have four input ports for attaching sensors: Ports 1, 2, 3, and 4.
A mini-USB PC connection port is used to connect a USB cable to your local computer and download programs to the EV3 brick (or to upload data from the robot to your local computer). You can also use the wireless Bluetooth connection for uploading and downloading programs.
The speaker included in Lego Mindstorms EV3 makes programs with real sounds possible, and you can listen to them when you run programs.
You apply a dark gray button at the center of the EV3 brick for powering on, entering commands, or running programs. The brick also has a light gray button on the upper-left side, which is used for reversing actions, aborting a program, and shutting down the EV3. The other four light gray buttons on the EV3 brick are used for moving left, right, up, and down while walking through the EV3 menu.
Typical technical specifications for Lego Mindstorms EV3 are listed below. Additional detail on the Lego EV3 specifications can be found at: http://www.lego.com/en-us/mindstorms/downloads .
Introduction to leJOS
leJOS means Lego for Java Operating System, which is an open source language created for developing software for Lego Mindstorms products using Java technology. The leJOS project offers support for Lego Mindstorms EV3, and previous versions including Lego Mindstorms NXT and Lego Mindstorms RCX. The leJOS project delivers the following solutions for Lego Mindstorms:
Lego Mindstorms EV3
JVM for EV3 Brick
leJOS API for EV3 brick
leJOS PC Communications
leJOS Tools
Lego Mindstorms RCX
JVM for RCX Brick
leJOS API for RCX brick
leJOS PC Communications
leJOS Tools
In this book, we are focused on the most recent Lego Mindstorms product: that is, Lego Mindstorms EV3. Typical official packages provided by leJOS for the EV3 brick are illustrated in Table . These packages allow you to manage the EV3 brick, sensors, and actuators, as well as some other pieces of EV3 hardware.
Table 1-1.
EV3 brick packages
Package | Description |
---|
lejos.hardware | To support EV3 hardware |
lejos.hardware.ev3 | To access EV3 hardware |
lejos.hardware.lcd | To access EV3 LCD |
lejos.hardware.motor | To access EV3 motors |
lejos.hardware.port | To access EV3 ports |
lejos.hardware.sensor | To access all the sensors that are supported on the EV3 |
lejos.hardware.video | To access video devices |
Table lists packages that offer support for some robotics problems, such as localization and navigation.
Package | Description |
---|
lejos.robotics.localization | Localization support |
lejos.robotics.mapping | Support for maps |
lejos.robotics.navigation | Navigation classes |
lejos.robotics.objectdetection | Object detection classes |
ejos.robotics.subsumption | Support for subsumption architecture |
All leJOS releases have documentation on the packages in the format of Javadoc. Details on the packages provided in leJOS EV3 can be found at: http://www.lejos.org/ev3/docs/ .