The text of the work is placed without images and formulas.
The full version of the work is available in the "Work Files" tab in PDF format
Designer Lego Mindstorms EV3
Creating and Calibration Program
Conclusion
Literature
1. Introduction.
Robotics is one of the most important areas of scientific and technical progress, in which the problems of mechanics and new technologies come into contact with the problems of artificial intelligence.
In recent years, successes in robotics and automated systems changed the personal and business sphere of our life. Robots are widely used in transport, in the research of land and space, in surgery, in the military industry, during laboratory research, in the field of safety, in the mass production of industrial goods and consumer goods. Many decision-makers based on data obtained from sensors can also be considered robots - such, for example, elevators, without which our life is already unthinkable.
Designer Mindstorms EV3 invites us to enter the fascinating world of robots, immerse yourself in the complex information technology environment.
Purpose: learn to program the movement of the robot in a straight line.
Get acquainted with the MindStorms EV3 designer and its programming medium.
Write a robot movement programs in a straight line by 30 cm, 1 m 30 cm and 2 m 17 cm.
Designer Mindstorms EV3.
Designer details - 601 pcs., Servomotor - 3 pcs., Color sensor, sensor motion sensor, infrared sensor and touch sensor. The microprocessor unit EV3, is the brain of the LEGO Mindstorms constructor.
For the movement of the robot corresponds to a large servomotor, which connects to the EV3 microcomputer and causes the robot to move: go back and forth, turning and passing along a given trajectory. This servomotor has a built-in rotational sensor, which allows you to very accurately monitor the movement of the robot and its speed.
Make a robot perform an action using computer Program EV3. The program consists of various control units. We will work with a motion block.
The motion block controls the robot engines, turns on, turns off, causes to work corresponding to the tasks. You can program movement to a certain number of revolutions, or degrees.
Preparatory stage.
Creating a technical field.
On the field of the robot, we will apply markup, with the help of a healent and ruler, create three lines of 30 cm long - a green line, 1 m 15 cm - red and 2 m 17 cm - black line.
Required calculations:
The diameter of the wheel of the robot - 5 cm 7 mm \u003d 5.7 cm.
One turnover of the robot wheel is equal to the length of the circumference with a diameter of 5.7 cm. The length of the circle is found by the formula
Where R is the radius of the wheel, D - diameter, π \u003d 3,14
l \u003d.5,7 * 3,14 = 17,898 = 17,9.
Those. For one turnover of the wheel, the robot passes 17.9 cm.
Calculate the number of revolutions necessary to drive:
N \u003d 30: 17.9 \u003d 1.68.
1 m 30 cm \u003d 130 cm
N \u003d 130: 17.9 \u003d 7.26.
2 m 17 cm \u003d 217 cm.
N \u003d 217: 17.9 \u003d 12.12.
Creating and calibrating the program.
We will create a program according to the following algorithm:
Algorithm:
Select a motion block in the MindStorms EV3 program.
Include both motor in a given direction.
Expect a change in the readings of the rotation sensor of one of the motors to a specified value.
Turn off the motors.
The finished program is loaded into the robot control unit. We put the robot on the field and press the start button. EV3 rides on the field and stops at the end of the specified line. But in order to achieve an accurate finishity you have to make calibration, since external factors affect the motion.
The field is installed on the student desks, so small surface deflection is possible.
The surface of the field is smooth, so the poor grip of the robot wheel with the field is not excluded.
In the calculations of the number of revolutions, we had to round the numbers, and therefore, changing hundredths in turnover, we achieved the desired result.
5. Transcue.
The ability to program the movement of the robot in a straight line will be useful for creating more complex programs. As a rule, in the technical tasks of competitions on robotics, all the dimensions of movement are indicated. They are necessary that the program would not have been rebooted by logical conditions, cycles and other complex control units.
At the next stage of acquaintance with the LEGO MindStorms EV3 robot, learn to program turns to a certain angle, movement in a circle, spiral.
Working with the designer is very interesting. Learning more about its capabilities, you can solve any technical tasks. And in the future, it is possible to create your own interesting models Robot Lego Mindstorms EV3.
Literature.
Koposov D. G. "The first step in robotics for 5-6 classes." - M.: Binom. Laboratory of Knowledge, 2012 - 286 p.
Filippov S. A. "Robotics for children and parents" - "Science" 2010.
Internet resources
http: // lego. rkc-74.ru/
http://www.9151394.ru/projects/lego/lego6/beliovskaya/
http: // www. Lego. COM / EDUCATION /
One of the basic movements in the layering is to follow the black line.
General theory and specific examples of creating a program are described on Wroboto.ru website.
I will describe how we realize it in the EV3 environment, since there are differences.
The first thing you need to know the robot is the meaning of the "ideal point", located on the border of black and white.
The location of the red point in the picture just corresponds to this position.
The perfect option for calculating is to measure the value of black and white and take the arithmetic average.
Make it can be manually. But the minuses are visible immediately: during even a short time, the illumination may change, and the value calculated is incorrect.
So you can make it make a robot.
During the experiments, we found out that measuring both black and white is optional. You can measure only white. And the value of the perfect point is calculated as a white value divided by 1.2 (1.15), depending on the width of the black line and the speed of the robot.
The calculated value must be written to the variable to turn to it later.
Calculation of the "perfect point"
The following parameter involved in the movement is the turning coefficient. What he is more, the sharp robot responds to a change in illumination. But too much importance will lead to the "prominance" of the robot. The value is selected experimentally individually for each robot design.
The last parameter is the base power of motors. It affects the speed of the robot. An increase in the speed of movement leads to an increase in the response time of the robot to change the illumination, which can lead to departure from the trajectory. The value is also selected experimentally.
For convenience, these parameters can also be written to variables.
Turning coefficient and base power
The logic of the black line movement is: the deviation from the perfect point is measured. What it is more, the stronger the robot should strive to return to it.
For this, calculate two numbers - the power value of each of the engines in and from separately.
In the form of the formula, it looks like this:
Where Isens is the value of the illumination sensor readings.
Finally, implementation in EV3. It is more convenient to issue in the form of a separate block.
Implementation of the algorithm
It was such an algorithm that was implemented in a robot for the middle category WRO 2015
This task is classic, ideologically simple, it can be solved many times, and every time you will discover something new.
There are many approaches to solve the tracking task. The choice of one of them depends on the specific design of the robot, on the number of sensors, their location relative to the wheels and each other.
In our example, three examples of the robot based on the main training model Robot Educator will be disassembled.
To begin with, we collect the basic model of the Robot Educator training robot, for this you can use the instructions in software Mindstorms EV3.
Also, for examples, we will need, EV3 light light sensors. These light sensors, like any others, are best suited for our task, when working with them, we will not have to forget about the intensity of the ambient light. For this sensor, we will use the reflected light mode in the programs, in which the amount of reflected light of the red light light is estimated. The boundaries of the sensor testimony of 0 - 100 units, for the "lack of reflection" and "complete reflection", respectively.
For example, we will analyze 3 examples of mobile trajectory motion programs on smooth, light background:
· One sensor, with a regulator.
· One sensor, with PK regulator.
· Two sensors.
The light sensor is installed on the beam, which is conveniently located on the model.
The action of the algorithm is based on the fact that depending on the degree of overlapping, the beam of the illumination of the black line sensor, returned by the testimony sensor gradiently vary. Robot saves the position of the light sensor on the border black line. Converting the input from the light sensor, the control system generates the rotation rate of the robot.
Since on the real trajectory, the sensor generates values \u200b\u200bin the entire operating range (0-100), then the value to which the robot is chosen 50. In this case, the values \u200b\u200bof the transmitted rotation functions are formed in the range -50 - 50, but these values \u200b\u200bare not enough for steep Turning the trajectory. Therefore, it should be expanded by a range of one and a half times to -75 - 75.
As a result, in the program, the calculator function is a simple proportional regulator. The function of which ( (A-50) * 1.5 ) The operating range of the light sensor generates the rotation values \u200b\u200baccording to the schedule:
This example is based on the same design.
You probably noticed that in the last example, the robot was overlooked that he did not give him enough to disperse. Now we will try to a little improve this situation.
To our proportional regulator, we add a simple cubic regulator, which will add bending to the regulator function. This will reduce the rocking of the robot near the desired boundary of the trajectory, as well as perform stronger jerks at a strong distance from it
Until now, in articles on algorithms used by movement along the line, such a way was considered when the illumination sensor seemed to follow the left or right border: a slightly robot will turn on the white part of the field - the regulator returned the robot to the border, the sensor will move in black Lines - the controller straightened it back.
Despite the fact that the picture above is for a relay regulator, the general principle of movement of a proportional (P-regulator) will be the same. As already mentioned, the average speed of such movement is not very high and several attempts have been made to increase it due to a minor complication of the algorithm: in one case, "soft" braking, in another, in addition to turns, was introduced forward.
In order to allow the robot in some areas to move forward, in the range of values \u200b\u200bof the illumination issued by the light sensor, a narrow plot was released, which could be called "the sensor is on the line border."
This approach has a small disadvantage - if the robot "follows" behind the left line of the line, then on the right turns, it is no matter how immediately determines the curvature of the trajectory and, as a result, spends more time on the search line and turn. Moreover, it is safe to say that than, cooler turn, the longer the time this search occurs.
The following figure shows that if the sensor was not from the left side of the border, but with the right, he had already found the curvature of the trajectory and began to make maneuvers on the turn.
On the placement of sensors on the robot, too, a few separate words should be said. It is obvious that, by the location of these two sensors, the same recommendations will be valid for the wheels as for one sensor, only for the top of the triangle, the middle of the segment connects two sensors. The very distance between the sensor should also be selected from the characteristics of the track: the closer the sensors will be located to each other, the more often the robot will be aligned (perform relatively slow reversals), but if the sensors are spread quite wide, that is, the risk of departure from the track, so you have to perform More "hard" turns and reduce the speed of movement in direct areas.
So sees a line man:
So sees her robot:
This feature we will use when designing and programming a robot for the category "Trajectory" competition category.
There are many ways to teach the robot to see the line and move along it. There are complex programs and quite simple.
I want to talk about a programming method that even children 2-3 classes. At this age they are much easier to build structures on instructions, and programming the robot is a difficult task for them. But this method will allow the child to program the robot on any route of the track for 15-30 minutes (taking into account the phased check and fit some features of the trajectory).
This method was tested at municipal and regional robotics competitions in the Surgut district and KMAO-UGRR and brought our first seats. I also made sure that this topic is very relevant for many teams.
Well, proceed.
When preparing for this type of competition, programming is only part of solving the task. You need to start with the design of the robot for a specific route. In the next article, I will tell you how to do it. Well, and since the movement along the line is found very often, I will start with programming.
Consider the version of the robot with two light sensors, as it is more understandable to students of junior classes.
Light sensors are connected to 2 and 3 ports. Motors to ports in and C.
Sensors are exhibited at the edges of the line (try experimenting, placing sensors at different distances from each other and at different heights).
Important moment. For better work Such a schema a couple of sensors is desirable to choose by parameters. Otherwise, it will be necessary to enter the unit for adjusting the sensor values.
Installing the sensors on the chassis according to the classic scheme (triangle), approximately as in the figure.
The program will consist of a small number of blocks:
1. Two illumination sensor block;
2. Four blocks of "mathematics";
3. Two blocks of motors.
Two motors are used to control the robot. The power of each 100 units. For our scheme, we take the average motor power value of 50. That is, the average speed when moving in a straight line will be equal to 50 units. When the rectilinear movement deviates, the power of the motors will increase or decrease, depending on the deviation angle.
Now we'll figure it out how to connect all the blocks, set up the program and what will happen in it.
Let's exhibit two light sensors and assign them ports 2 and 3.
We take a block of mathematics and choose "subtraction".
We connect illumination sensors from the "Intensity" outputs of the tires to the math unit to the inputs "A" and "B".
If the robot sensors are set symmetrically from the center of the route line, the values \u200b\u200bof both sensors will be equal. After subtracting, we get a value - 0.
The next math unit will be used as a coefficient and you need to set multiplication in it.
To calculate the coefficient, you need to measure the level of "white" and "black" using the NXT block.
Suppose: white -70, black -50.
Next, we consider: 70-50 \u003d 20 (the difference between white and black), 50/20 \u003d 2.5 (the average power value when moving in a straight line in the math blocks we put in 50. This value plus the added power when adjusting the motion should be equal to 100)
Try to set the value of 2.5 to the "A" input, and then select more accurately.
To the input "in" Mathematics block "Multiplication" Connect the output "result" of the previous block of mathematics "subtraction".
Next, there is a pair - a block of mathematics (addition) and Motor V.
Setting the Mathematics Block:
At the input "A" set to 50 (half of the power of the motor).
The output of the "result" block is connected to the "power" input of the motor
Following the pair - a block of mathematics (subtraction) and a motor S.
Setting the Mathematics Block:
The input "A" is set to 50.
The input "B" is connected by the tire with the output of the "result" of the Mathematics block "Multiplication".
The output of the "result" block is connected to the input of the "power" of the S. motor
As a result of all these actions, you will receive such a program:
Since it will all work in a cycle, we add a "cycle", we allocate and transfer it all to the "cycle".
Now let's try to figure out how the program will work and how to configure it.
While the robot goes in a straight line of the sensor values \u200b\u200bcoincide, it means that at the output of the subtraction block will be 0. The output of the multiplication unit also gives a value of 0. This value is applied in parallel to the motor control pair. Since in these blocks is set to 50, the addition or subtraction of 0 does not affect the power of the motors. Both motors work with the same power 50, and the robot rolls in a straight line.
Suppose the track makes a turn or robot deviate from the line. What will happen?
Figure shows that the illumination of the sensor connected to port 2 (hereinafter referred to as the protector 2 and 3) increases, as it moves onto a white field, and the illumination of the sensor 3 decreases. Suppose the values \u200b\u200bof these sensors become: a sensor 2 - 55 units, and a sensor 3 - 45 units.
The "subtraction" block will determine the difference between the values \u200b\u200bof the two sensors (10) and will give it to the correction unit (multiplication of the coefficient (10 * 2.5 \u003d 25)) and then in the control blocks
Motors.
In the math unit (addition) of the motor control to the value of the average speed 50
add 25 and the value of the power 75 will be submitted to Motor V.
In the math unit (subtraction) of the motor control C from the value of the average speed 50, 25 will be deducted and the power value 25 will be fed to the Motor S.
Thus, the deviation from a straight line will be adjusted.
If the track turns sharply towards and sensor 2, it turns out on white, and the sensor 3 on black. The illumination values \u200b\u200bof these sensors become: a sensor 2 - 70 units, and a sensor 3 - 50 units.
The "subtraction" block will determine the difference between the values \u200b\u200bof the two sensors (20) and give it to the correction unit (20 * 2.5 \u003d 50) and then in the motor control blocks.
Now in the math unit (addition) of the motor control to the value of power 50 +50 \u003d 100 will be submitted to Motor V.
In the math unit (subtraction) of the motor control with the value of the power 50 - 50 \u003d 0 will be fed to the Motor S.
And the robot will perform a steep turn.
On white and black fields, the robot should ride in a straight line. If this does not happen, try choosing sensors with the same values.
Now let's create a new block and will use it to move the robot on any track.
We select the cycle, then in the "Edit" menu, select the "Create My Block" command.
In the Block Designer dialog box, we will give the name to our block, for example, "Go", select the icon for the block and click "Finish".
Now we have a block that can be used in cases where we need to move along the line.