Reader small image

You're reading from  Learning Lego Mindstorms EV3

Product typeBook
Published inJan 2015
Publisher
ISBN-139781783985029
Edition1st Edition
Right arrow
Author (1)
Gary Garber
Gary Garber
author image
Gary Garber

Gary Garber teaches physics, math, and engineering at Boston University Academy. Gary is the president of the New England Section of the American Association of Physics Teachers and has led dozens of professional development workshops in education at both the local and national levels. Gary runs the Boston University FIRST Robotics program. He has run and hosted numerous robotics workshops in VEX, Tetrix, and LEGO platforms. He has run dozens of LEGO robotics tournaments and spoken on robotics education at both local and national conferences. His robotics team has worked with Engineers Without Borders, NASA, and the National Science Teachers Association on a variety of engineering and education projects. He is currently an educational consultant, working to develop new software tools for the classroom, at the Tufts Center for Engineering Education and Outreach, which is a pioneer in LEGO Robotics Education. He is the author of Instant LEGO MINDSTORMS EV3, Packt Publishing. He currently resides in Massachusetts, US. When he is not playing with LEGO, robots, or toy trains, he enjoys spending time with his wife, Catalina, and their two children, Alejandro and Leonardo.
Read more about Gary Garber

Right arrow

Chapter 9. Experiment Software and Data Logging

In this chapter, you will learn how to use the data logging features of the LEGO MINDSTORMS Educational Edition software. You will:

  • Learn how to autonomously collect data

  • Learn how to graph data to analyze our robot's performance

  • Improve dead reckoning

  • Analyze gain constants

  • Learn how to write graphical programs

Graphical programs are different from the block and wire-based programming we have engaged in so far.

Data logging software


There are four major differences between the Home and Educational Editions of the LEGO MINDSTORMS EV3 software, which are as follows.

  • Cost: You can download the Home Edition of the Software for free, whereas a single license of the Education Edition of the software is about $100 and a site license is about $400.

  • Appearance: The Home Edition has a lobby or splash page, which is reminiscent of a Hollywood robot invasion movie, which is not found in the Educational Edition.

  • Sensor blocks: The Home Edition does not include sensor blocks for the Gyro Sensor or the Ultrasonic motion sensor, but these can be downloaded and imported.

  • Data logging: The most significant difference is the data logging features of the Educational Edition. The data logging is so distinct and different that I would almost qualify it as a different piece of software.

What good is the data logging software? If you are an elementary or middle school teacher, data logging can easily be a great tool. Data...

Improving dead reckoning


In this next section, we will use autonomous data logging to collect sensor data, which we will graph and then analyze to improve our dead reckoning skills. Because the Gyro Sensor is so susceptible to drift, I know many FIRST LEGO League (FLL) teams who still prefer to use dead reckoning to navigate a course. Reconciling the amount of turning in dead reckoning with the values of the Motor Rotation sensors can be tedious and time consuming.

Data logging allows us to directly compare the values of the Gyro Sensor to the values of the Motor Rotation sensors over a period of time.

Let's begin by attaching a Gyro Sensor to port 2 on our robot. For the graphs in this chapter, I attached the Gyro Sensor to the caster-bot, but you can do this with any of our robots. In the following screenshot, you can see a simple program to acquire and store data from the sensors:

In the following steps, I will describe the program in the preceding screenshot:

  1. We start out by using sensor...

Analyzing gain constants


In the previous chapter, we discussed proportional and PID control algorithms. When it was time to determine the best gain, derivative, and integral constants, we largely left things up to trial and error. Patient use of data logging would allow us to quantitatively analyze the quality of various values of these constants. This would be particularly useful in line tracking as we can graph the error function and corrections as a function of time, and compare this to the location along the line being tracked (and the degree of curvature at that point).

In the following program, we are going to analyze the performance of a simple proportional line tracker similar to the one we used in Chapter 8, Advanced Programming and Control. After resetting the motor rotation sensors, we use a Data Logging block to record values from the Color Sensor and the Motor Rotation sensors. We are recording the Reflected Light Intensity of the Color Sensor, which is plugged into port 3. Instead...

Graphical programming


The graphical programming features allow you to write simple programs based on sensor (or calculated) values on a graph. Unfortunately, you are limited to only the Action blocks, which include controlling the motors, the brick display, the brick lights, and the speaker. Again, the EV3 tutorials do a satisfactory job of explaining some elementary uses of the graphical programming. For instance, LEGO describes how to use the value of the temperature sensor to control a fan. One particular use of the graphical programming, which I like, is to program a three-level bang-bang controller. With the normal EV3 programs, this takes a few additional steps, but is rather straightforward with graphical programming. This also makes the concept of a setpoint and a bang-bang controller easy to understand for the most novice of students.

In the following screenshot, we see a graphical program using Reflected Light Intensity from our Color Sensor. The graph is broken into three regions...

Other bang-bang controllers


In the following graphical program, instead of the Color Sensor, a Gyro Sensor is used to control the zones. One major difference you may notice is the discreteness of this graph. This is because the Gyro Sensor readings are not continuous but are only measured to the nearest degree. In this case, I spaced the circle and star zones two degrees apart. From the graph, you can see that the robot started to oscillate around the rectangular zone, but eventually settled down.

In this graphical program, as you can see from the programming panels in the following screenshot, the robot is attempting to drive at a given angle. In the star zone, the robot will turn to the right, in the circle zone it will turn to the left, and in the rectangular zone it will drive straight. Another distinct advantage of using a graphical program is the trouble with negative numbers. From the default position of zero degrees, if a robot turns to the left, the Gyro Sensor will present a negative...

Summary


In this chapter, you learned how to use the data logging features of the EV3 software. You learned how to quantitatively improve your dead reckoning skills using data logging. You also learned how you would analyze the proportional gain constants by looking at graphs of the sensor values. Lastly, you learned how to write simple three-level controllers using graphical programming.

In the next chapter, we will explore other programming languages for the EV3 hardware.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learning Lego Mindstorms EV3
Published in: Jan 2015Publisher: ISBN-13: 9781783985029
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Gary Garber

Gary Garber teaches physics, math, and engineering at Boston University Academy. Gary is the president of the New England Section of the American Association of Physics Teachers and has led dozens of professional development workshops in education at both the local and national levels. Gary runs the Boston University FIRST Robotics program. He has run and hosted numerous robotics workshops in VEX, Tetrix, and LEGO platforms. He has run dozens of LEGO robotics tournaments and spoken on robotics education at both local and national conferences. His robotics team has worked with Engineers Without Borders, NASA, and the National Science Teachers Association on a variety of engineering and education projects. He is currently an educational consultant, working to develop new software tools for the classroom, at the Tufts Center for Engineering Education and Outreach, which is a pioneer in LEGO Robotics Education. He is the author of Instant LEGO MINDSTORMS EV3, Packt Publishing. He currently resides in Massachusetts, US. When he is not playing with LEGO, robots, or toy trains, he enjoys spending time with his wife, Catalina, and their two children, Alejandro and Leonardo.
Read more about Gary Garber