How to play football with LEGO Mindstorms Robots. Introduction
Football with robots could be quite fun. Football with LEGO Mindstorms robots is one of the popular categories for competitions with LEGO Mindstorms Robots.
- #945
- 20 Sep 2018
Football with robots could be quite fun. Football with LEGO Mindstorms robots is one of the popular categories for competitions with LEGO Mindstorms Robots.
We should multiply the error by a certain number and then add it to the steering of the LEGO Mindstorms Steering block. In this way, by changing the coefficient we change how much/fast should the proportional part influence the steering of the robot.
After we take each sample, we perform calculations and these calculations could take different time. It is important to know how much time does it take to perform the calculations. In this video tutorial, we would data log the time and plot the data.
Let's record the values of the Gyro Sensor while the robot is moving and is trying to keep its orientation straight. This is an interesting experiment and we will have to use file access to write the values to a file.
This video tutorial contains the final 2 programs for moving straight with a LEGO Mindstorms EV3 robot. The first program is for proportional compensation that just keeps the robot orientation straight, while the second program is for Integral compensation that returns the robot to the straight line when the robot makes a mistake.
In this video tutorial, we would do a few experiments with the coefficients for the Integral compensation. There are actually two coefficients - "c" and "b"
This video tutorial is about understanding the "magic". In this video tutorial, we would conduct an experiment and will look at how exactly does the integral part of the PID algorithm compensate for the error that the LEGO Mindstorms EV3 robot makes.
The integral part "remembers" the errors that the robot has made in the past and we can compensate for those errors. This will make the robot return back to the line that we would like to keep it aligned.
This is where the confusion really comes. We are keeping the robot orientation straight while the robot moves, but at the end the, robot is not at the fiinal location that we would like it to be. The robot is still about 2-3 centimeters away after moving for about a meter.
We keep the robot orientation straight while moving, but when we stop the robot could be in a different orientation. This applies for both using the Mindstorms Gyro Sensor when moving straight or the Mindstorms Color sensor when following a line. In this video tutorial, we will do a few examples of when an how this could happen.
The first part of making the robot move straight is to keep it oriented straight. While it moves it could make an error and turn slightly to the right and then the program should turn in back to the left to make its orientation straight. In this video tutorial, we would discuss how to implement a program to keep the robot orientation straight even when we are pushing or pulling it to either side and in the same time it has different wheels.
The LEGO Mindstorms EV3 set comes with two LARGE motors. But even though these motors look almost the same they are not quite the same. There are always some differences in their behaviour. If you have more than two motors, because you bought them or you won them somewhere at a competition, it is worth doing an experiment to find which pair of motors works best.
The robot can move with different speed by applying different power to the motors. It will most of the time make smaller deviations when it moves slower. But you can't just move with a power of 10 all the time. This is a way too slow especially for competitions like FIRST LEGO League or World Robot Olympiad. In this video tutorial I would like to discuss the balance between motor power and robot movement error, how does the battery influence the power of the robot and to conduct an EV3-G experiment that will record the values of the Gyro Sensor along with the current power.
Following the Advanced Sensor Calibration course section, it is time to extract the logic for getting a calibrated value into a new block. This block will have an input and on this input, we give the port number. The block will return the calibrated value for this port number. We've built all the other blocks only because of this almost final video here.
One of the smartest things you could do in any software program is to extract logic in small reusable, simple, understandable units. In EV3-G these are called Blocks and we are going to extract the logic for finding a minimum and maximum for each of the sensors in a new block.
In this tutorial, we show you how to display all the values from an EV3-G array on the EV3 brick display. We are using an array Read Operation along with a loop. We are also detecting the loop counter and using it as an index to an array. It's basically the only viable way to do it. The process is commonly referred to as - "Iteration over an array" (although we still do not have an iterator in the programming language, we promise that one day we would do the super advance videos on "iteration" using the LEGO MINDSTORMS robots")
A common question is how to display arrays on the LEGO Mindstorms EV3 brick screen. Displaying values from an array is not different from any other display operation. In this tutorial, we would look at displaying two specific values. The minimum and the maximum for a specific sensor from the Advance Calibration Course Section
Following the Advance Light/Color sensors calibration for a minimum value for a single sensor tutorial, in this one, we continue with finding the maximum value detected by a sensor and storing this value in an array.
Implement a program for stopping at a black line with the blocks containing the implementation details for the InitArray, Calibration and Getting the calibrated result.
Following the previous tutorials from the course, implement the calibration of the minimum and maximum values.
As an exercise try to implement the calibration of the minimum and maximum values for a single sensor.
Implement the program for array initialization.
Follow the video tutorials for initializing arrays and implement the program.
Many times we just upload blocks and leave it up to you to use it. In this tutorial, I would like to show you how to use the implemented blocks. How to import them into the EV3-G software. How to see them in the palette. How to drag and drop them to build a working program.
Following the Advance Sensor Calibration course section, we found the min and max values detected by each sensor. Now it is time for the real deal of the calibration. Detect the current value from the sensor and find what is the percentage of this value for the range between min and max.
In the course section for Advance Sensor Calibration we previously showed you how to find the minimum and maximum value for a single LEGO Mindstorms Color Sensor and to store this value in an array. The program was implemented with the EV3-G software. In this tutorial we are going to find the Min and Max for all the four sensors and to store all the 8 values in an array.
In this tutorial, we would implement a program that finds the minimum and maximum value detected by the sensor and stores this two values in an array.
"Array initialization" is the first step in every program that involves Arrays. This applies to most programming languages and for EV3-G it is a must.
In this tutorial, we would show you how to initialize the array and how to extract this logic in a new block