0% found this document useful (0 votes)
11 views22 pages

Program Description WRO 2024 JUNIOR

The document provides a detailed program description for a robot designed for the WRO 2024 Junior High competition, focusing on various algorithms and methods implemented in EV3G. Key topics include line following techniques, smooth braking, and the use of RGB sensors for element detection, along with specific parameters for motor control. The document also outlines the robot's operational concept, main and auxiliary blocks, and the algorithm for element retrieval and delivery.

Uploaded by

jafarov.rashad99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views22 pages

Program Description WRO 2024 JUNIOR

The document provides a detailed program description for a robot designed for the WRO 2024 Junior High competition, focusing on various algorithms and methods implemented in EV3G. Key topics include line following techniques, smooth braking, and the use of RGB sensors for element detection, along with specific parameters for motor control. The document also outlines the robot's operational concept, main and auxiliary blocks, and the algorithm for element retrieval and delivery.

Uploaded by

jafarov.rashad99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

WRO 2024 JUNIOR HIGH

“58 SEC” ROBOT’S


PROGRAM DESCRIPTION.
Contents

Preface ………………………………………………………… 2

PD line follower …………………………………………… 3

Smooth braking ……….………………………………….. 9

PD line follower with one sensor ….……………. 10

Stable movements …………………………………….. 11

Concept ………………….…………………………………. 13

Main blocks ………………………………………………. 13

Auxiliary blocks …………………………………………. 15

RGB block and scanning …………………………….. 17

Algorithm ………………………………………………….. 19

1
Preface
The file represents methods implemented to the robot and describes
the program written in EV3G.
The instruction, the Studio 2.0 file and extra videos with more placings
are also provided.
It is important to know that the robot will not do the task perfectly
right after you build it, connect the cables and upload the program.
You will probably have to adjust it, pick up degrees, sensors’ thresholds
for scanning the lines and colors. To simplify this process you should
use motors for going with the same power and the sensors for line
following with the same values on black and white colors on the field.
The power of the motors can be checked this way:

I prefer to check the power without any loadings.


Sensors’ values can be checked in the EV3 block in Port View. You need
to look at their values on black and white colors. The difference
between two sensors should not be above 1-3. If it is more, the robot
will be budged either left of right relatively the line while following it,
which is not very good.

2
The robot also uses RGB block:

You need to import this block. In EV3G open Tools -> Block Import and
import the needed block. Ev3b file with this block is provided with
other files in the Boosty post.

PD line follower
One of the most popular questions – how to make a robot follow a line
perfectly without twitching.
PD line follower is an answer.

It is based on a simple idea: U = KP * e + KD * (e – e_old). Let’s figure


out what these letters mean.
U is a so-called “guiding influence”. This is a correction to motors’
speed.
KP, KD – some coefficients, they are found by selection. Usually KD =
KP * 10.

3
e – “error”, current difference between line following sensors, e_old –
the difference on the previous iteration.

This algorithm works pretty well if you find good KP and KD. However,
sometimes the robot might stand inaccurately on the line, for example
after turning or doing any other complicated movements. In this case
PD might “save the robot”, but the further PD will be provided with
twitching. Thus the robot will arrive to the needed spot inaccurately,
which can lead to big mess.
There is a good solution of this problem, I called it “evening out”.

This means the robot will follow the line some time to stand accurately
on the line. This is like a PD with the specific speed, KP and KD to make
the further movements slight and smooth (KP and KD in this case might
be bigger than usually). As the robot evens out, we know it definitely
stands accurately on the line.

4
The robot may pass crossroads, to avoid twitching after passing we can
restrict motors’ speed.
We do not allow the speed to decrease or increase to the specific
numbers, which allows the robot to follow the line perfectly.

5
Let’s look at the PD represented in the program.
There are three main PDs – PD_Enc, PD_Cross_X and PD_Cross_T.

PD_Enc is a PD which goes until the number of needed degrees is


achieved.

The 1st parameter is speed


The 2nd is a number of degrees
The 3rd one is interesting. This parameter is “1” by default (“True”),
which means “evening out” will be performed (“0” – it will not).
Sometimes this is not necessary for a robot to even out, for example
when it is going on one PD and you want to switch on a new one.
The 4th is “Type”. There is a special block named Types, there are
movements that must be performed right after PD, or the motors are
just stopped (type = 0), or the motors continue rotating (type = -1, it is
used when we switch current PD on another immediately). You choose
a movement robot will do after PD by writing a number which
corresponds this movement.

6
The next two are PD_Cross_X and PD_Cross_T. There are two types of
crossroads – type “X” and type “T”. It is better to separate them.

Type “T” Type “X”

The only difference between these two PDs is a condition of defining


the crossroad.
PD_Cross_X checks if every individual sensor reached the crossroad:

PD_Cross_T checks if the sum of the sensors’ values is less than the
specific number:

7
Let’s look at the parameters:

The 1st parameter is speed.


The 2nd is a number of degrees the robot goes before it starts checking
the crossroad.
The 3rd is a number of degrees the robot goes after the crossroad.
The 4th – “evening out” (“1” – it is performed, “0” – it is not).
The 5th parameter is responsible for slowing down after the crossroad
(This parameter obviously makes sense only if the 3rd parameter is
above 0). “1” means the speed will decrease to 20, “0” means the
speed will stay the same.
The 6th is “Type”.

It is worth mentioning that the number of degree is not taken from


one motor, it is an average number from both:

It is important to notice a block named Kp. Its purpose is to set KP


depending on a speed:

8
There is also a special variable s_even, which purpose is to set the
speed of the evening out:

Smooth braking
There is a term we should pay attention to - “Smooth braking”. When
the robot goes on a high speed it can slip some degrees after scanning
a crossroad. To avoid it we should decrease speed in advance – 200-
300 degrees before checking the crossroad. Let’s imagine a situation –
the robot has to go ~1000 degrees and 373 degrees after the
crossroad. It is represented in this picture:

Taken from Taking


PD_Enc has “-1” as the fourth parameter so that the motors would go
on rotating. PD_Cross_T has “0” as the fourth parameter not to even

9
out, and “0” as the fifth parameter so that the robot would keep its
speed.

PD line follower with one sensor


The concept is the same as with PD for two sensors. The evening out
works in another way: the robots stands for 0.3 seconds with zero
speed so that the robot would “stick” to the line:

Taken from PD_Start


The error now is the difference between the sensor and the desired
average value the sensor needs to follow.

10
Stable movements
To make a robot move stable several things should be comprehended.
First of all, we should understand the difference between “green” and
“blue” motors’ blocks:

Green motor blocks have some kind of a regulator inside them for
speed supporting. This means the motor will always rotate with the
needed speed.
Blue motor block does not always support the needed speed. This
block is more compromising, when meeting any obstacles the motors
will not try to rotate with the supposed speed. The speed can also
decrease with the battery level.
Blue motor blocks, for example, are usually used when a robot Is
moving along the field border.
I prefer to use blue motor blocks in the line follower, the robot seems
to move smoother than with green motor blocks.
To make movements stable there need to be a small pause (0.2-0.3
seconds) if the robot switches green motor block to blue one and vice
versa so that the robot would not bevel:

Taken from Bikes


11
In Senior category, for example, when the 123 points robot goes until
the sensors see the red border of the start the motors’ block should be
changed to green block, because there is no line anymore and green
motor blocks will be more stable at riding straight forward.
Another thing is worth mentioning: it is good to make some
movements without breaks. For example, the robot goes some
degrees and needs to continue moving with one wheel. In this case the
next steps should be carried out: one wheel is stopped and the other
one continues rotating. The example from the program:

Taken from Kits


In the opposite situation this logic works as well. If the robot goes with
one wheel and after needs to go straight the second motor should be
turned on:

Taken from Kits


Now let’s sum up the information. The blue motor block is better to be
used in PD and needs to be used in the movements that are right after
PD. In cases of going straight and moving with one wheel green motors
are more suitable. If the robot stops after using blue motor block,
some pause should be held before using green motor blocks (However,
before the block Turning sometimes I neglect this rule since this does
not affect in a bad way, unlike the other cases).

12
One more thing to make a robot stable is a pause or a delay. The
elements might be shaking after turning, so the robot should wait 0.2-
0.3 seconds so that the elements would “calm down”:

Taken from Parks

Concept
The robot starts with scanning the elements and putting the cable in
the charging area. Next, the robot takes the first three elements and
delivers them in the Park B. After, the robot takes the remaining three
elements, pushes the bikes and delivers the elements in the Park A.
Finally, the robot takes the kits and delivers them – closes the door
after putting the last kit.

Main blocks

Initialization – all the variables are originated here.

13
Start – the elements are scanned, the cable is delivered.

Parks – the first three elements are taken and delivered,


the remaining three elements are taken.

Bikes – the bikes are pushed, the remaining three


elements are delivered.

Kits – the kits are taken and delivered, the door is closed.

14
Auxiliary blocks
Turning – allows the robot to revolve on its axis.
The robot rotates until the sensor which is the
closest to the line scans it.
The 1st parameter is the direction – “1” is
clockwise, “0” is not clockwise.
The 2nd is a number of degrees the robot
rotates (average of each motor) before
the closest sensor starts checking the line.
The 3rd parameter is the speed which is
supported the selected number of degree.

Manipulator – makes some procedures with


the motors A and D (gripper and
compartments respectively).
“1” - to close the compartments (Motor D)
“10” - to open the compartments (Motor D)
“2” - to squeeze the gripper (Motor A)
“20” – to open the gripper (Motor A)

15
Taking – the robot takes the elements from
different positions, depending on the parameter
(will be explained in Algorithm).

Scanning – the block used parallel to PD_Start to


search for lake elements.

PD_Start – the PD which uses one sensor.

PD_Green – the PD which uses one sensor and


RGB block (B-component in our case).

16
Logic – the Algorithm procedures are carried out
here.

RGB block and scanning


RGB block is used in several places.
First of all, it is needed to search for the lake elements. Here is how it
works: the block Scanning works parallel to PD_Start and looks for two
elements. The sensors checks the B-component, if the component is
bigger the threshold several times in a row, then the sensor sees the
lake element:

Taken from Scanning


After finding the lake element the robot goes 80 degrees not to find
the same element again and starts looking for a new one:

17
Taken from Scanning
Another place where RGB block is used is PD_Green. This block is used
when going to the Park A, this PD goes with one sensor. B-component
is used:

Taken from PD_Green


The thresholds need to be selected. The RGB values can be seen this
way:

18
Algorithm
There are six places where the two lake elements can be:

The robot does not scan all the six elements, it just looks for the blue
ones. After finding each, the robot remembers the number of degrees
it had when the blue element was spotted. Variables enc_3 and enc_4
are responsible for that:

Taken from Scanning


Knowing degrees, the number of the element can be defined – we
divide the six places (6-1) into six intervals of degrees and see if the
variables match to the intervals:

19
Taken from Logic
It is not necessary to check all the six intervals. To define the position
of the first blue element it is enough to check the five intervals from 6
to 2. The same logic works with the second element – only 5-1 intervals
need to be checked.
Variables dug_1 and dug_2 keep the numbers of the blue elements,
dug_1 > dug_2.
The robot takes three elements two times. Three elements must
contain two black and one blue. There are five types of taking the
elements – taking from positions 123, 234, 345, 456 and 126 or 156.
The last two takings (126 and 156) can be combined in one type. There
are two variables which keep the number of two takings – n_1 and
n_2. Variable n_1 might contain numbers 123, 234, 345 – they
correspond to the numbers of places. Variable n_2 might contain
either 456 or 404, 456 means taking from places with numbers 456,
20
404 means the robot will take elements from 126 or 156 places. The
variables are formed this way: the difference between dug_1 and
dug_2 is checked. Depending on the difference the variables n_1 and
n_2 are formed:

Taken from Logic


The block Taking carries out the type of taking depending on the
number:

Taken from Parks

21

You might also like