House, design, repair, decor. Yard and garden. Do it yourself

House, design, repair, decor. Yard and garden. Do it yourself

» EV3 Movement over the line stop on the turn. LEGO EV3.

EV3 Movement over the line stop on the turn. LEGO EV3.

Consider the simplest movement algorithm on the black line on one color sensor on EV3.

This algorithm is the slowest, but the most stable.

The robot will move not strictly in the black line, but at its border, adding to the left, then right and gradually moving forward.

The algorithm is very simple: if the sensor sees black, the robot turns one way, if white is in another.

Implementation in LEGO MindStorms EV3

In both blocks of movement, select "Enable" mode. Customize the switch to the color sensor - the measurement is color. At the bottom, do not forget to change "no color" on white. Also, you need to correctly specify all ports.

Do not forget to add a cycle, without him the robot will not go anywhere.

Check out. To achieve a better result, try changing the steering and power values.

Movement with two sensors:

You already know the algorithm of the movement of the robot on the black line using one sensor. Today we consider moving along the line using two color sensors.
Sensors need to be installed in such a way that the black line passes between them.


The algorithm will be the following:
If both sensors see white - moving forward;
If one of the sensors sees white, and the other black - turn towards black;
If both sensors see the black color - we are at the crossroads (for example, we will stop).

To implement the algorithm, we need to track the readings of both sensors, and only after that set the movement of the robot. For this we will use the switches attached to another switch. Thus, we first poll the first sensor, and then, regardless of the readings of the first, interview the second sensor, after which we set the action.
Connect the left sensor to port number 1, right to port number 4.

Program with comments:

Do not forget that the motors are running in "Enable" mode so that they work as much as necessary on the basis of sensor readings. Also, often forget about the need for a cycle - without it the program will immediately end.

http://studrobots.ru/

The same program for the NXT model:

Examine a movement program. Program the robot. Send video testing video

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

Preparatory stage

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 /

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.

Example 1. One sensor, with a regulator.

Design

The light sensor is installed on the beam, which is conveniently located on the model.


Algorithm

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:

An example of the work of the algorithm

Example 2. One sensor, with PK regulator.

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

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


To see a presentation with pictures, design and slides, download its file and open in PowerPoint on your computer.
Text Content Slides Presentation:
"Movement algorithm for a black line with one color sensor" Circle on "Robotics" Teacher to Yezidov Ahmed EliyevichPri MBU to "Silkovo CTT" to study the algorithm of movement in the black line, will be used by the LEGO MindStorms EV3 robot with one color sensor, the color dealer color distinguishes 7 Colors and can determine the absence of color. As in the NXT, it can work as a light sensor. Quick for the Robot Robot Competitions The proposed polygon with a highway in the form of the letter "S" will allow you to make another interesting testing of the created robots for the speed and reaction. Consider the simplest algorithm of the movement on the black line on one color sensor on the EV3. The algorithm is the slowest, but the most stable. Using will move not strictly in the black line, but at its border, turning to the left, then to the right and gradually moving the frontal carbonate very simple : If the sensor sees black, the robot turns one way, if white is in another. Movement on the line in the brightness mode of the reflected lights. Two sensors about the color sensor is not enough effectively to distinguish black and white colors. The solution to this problem is to use the sensor not in the color definition mode, but in the mode of determining the brightness of the reflected light. In this mode, we, knowing the sensor values \u200b\u200bon a dark and light surface, can independently say that it will be considered white, and what is black. Now we define the brightness values \u200b\u200bon white and black surfaces. To do this, in the EV3 block menu, we find the "Module Applications" tab now you are in the port view window and you can see the readings of all sensors at the moment. Our sensors should be highlighted in red, which means that they work in the mode of determining the brightness of the reflected light. If they are shined in blue - in the port viewing window in the desired port, press the center button and select the COL-REFLECT mode. We put the robot mode so that both sensors are located above the white surface. We look at the numbers in ports 1 and 4. In our case, values \u200b\u200b66 and 71, respectively. This will be white sensors. Now we put the robot so that the sensors are located above the ferrous surface. Again, let's see the values \u200b\u200bof the ports 1 and 4. I have 5 and 6, respectively. These are black values. Further, we will change the previous program. Namely, change the settings of the switches. While they have a color sensor -\u003e Measurement -\u003e Color. We also need to establish a color sensor -\u003e Comparison -\u003e Brightness of the reflected light. We must set the "comparison type" and "threshold value". The threshold value is the value of some "gray", the value of which we will consider black, and more - white. For the first approximation, it is convenient to use the average value between the white and black of each sensor. Thus, the threshold value of the first sensor (port number 1) will be (66 + 5) /2\u003d35.5. Rounded to 35.Pong value of the second sensor (port number 4): (71 + 6) / 2 \u003d 38.5. Rounded to 38. Now exhibit these values \u200b\u200bin each switch, respectively. Everything and all, blocks with movements remain in their places without change, as if we put in the "Type of Comparison" sign "<», то все, что сверху (под галочкой) будет считаться черным, а снизу (под крестиком) – белым, как и было в предыдущей программе.Старайтесь ставить датчики так, чтобы разница между белым и черным была как можно больше. Если разница меньше 30 - ставьте датчики ниже. Это было краткое руководство по программированию робота Lego ev3, для движения по черной линии, с одним и двумя датчиками цвета