Robot With Obstacle Detection - fischertechnik Mobile Robots II Manual De Instrucciones

Ocultar thumbs Ver también para Mobile Robots II:
Tabla de contenido

Publicidad

Idiomas disponibles

Idiomas disponibles

GB+USA
The different values reduce the risk of getting stuck in a corner.
Solution:
We can deduce from the task that we have to control the robot
dependent on the edge detectors. Consequently, we should first
split up the task into smaller parts. We first query the sensors
Z2 = 0 is new. After you think about it for a while, you will under-
stand the sense of this. If you do not set the count variable to zero,
the mechanism only works once, because when Z2 reaches the value
of the variable VAR10, our distance counter would fail us in each sub-
sequent run. From the viewpoint of professional programmers, we are
dealing with local and global variables here. The local variable Z2 is
initialized before each use in the subprogram.
22
(edge detectors). If no sensor is active, the robot
moves forward. This is the "Forward" block in
the diagram. A subprogram is behind such a
block, which is new to us. Subprograms improve
the clarity of complex systems, and they can
also take better advantage of your computer's
performance with multiple use. Our first
subprogram is very simple; it only triggers
movement of the motors M1 and M2.
But we need additional subprograms. The robot
should move left, right or backward to avoid falling
depending on the situation. In this case, it no
longer suffices to simply switch on the motors. A
specific sequence of movements must be
programmed. Let's take a look at another
subprogram. This should cause the robot to move
backward when it detects an edge.
We want to switch the motors to backward
movement for this. Then our pulse wheel should
detect a defined distance. Set the distance with
the variable VAR10. The assignment block
Conclusion:
Subprogram calls increase the clarity of programs. We use variables to
measure various values, in this case path distances. We need the different
path distances, so that our robot can "free" itself from corners. If the paths
were absolutely identical, a robot could always move back and forth in a
corner.
When you use variables, pay attention to their validity range. We initialize
local variables, i.e., variables that are only used within a subprogram, before
their use.
We have also seen that our robot needs a certain amount of movement
leeway for it to function properly. If it runs into an edge during a movement
to avoid another edge, the robot cannot react to it. Those of you who really
enjoy solving such puzzles can try to find a solution for this.

4.3 Robot with Obstacle Detection

Our robots can now detect edges very well. But there is still a problem
with ordinary obstacles. We have to modify the principle of edge detection.
A corresponding crash contact replaces the auxiliary wheels. At this time,
you should also think about one shortcoming of the edge detector; there
are dangerous situations when the robot can "blindly" plunge into the abyss
during backward movement without a sensor in the back.
A third sensor can compensate for this shortcoming. In the meantime, we
have become experienced programmers. Fortunately, because the task is
more complicated this time, as a look at the program shows.
The program contains additional, new function blocks. We add a WAIT block
at specific program positions. This is easy to understand: the program waits
until the time entered here has finished before the next program function is
processed.
Logical comparisons are really new. Up to now, we have always made a
comparison with the sensor queries and put a corresponding branch in our
program. A similar comparison exists for pulse counting: comparison with a
specific number of pulses. The logical comparison with several expressions is
also new in a COMPARE block
Task 4:
Assembly the robot as described in the construction instructions with
the faster gear reduction 50:1. The model should move straight
ahead. As soon as an obstacle is detected at one of the front sensors
(E3 or E4), the robot stops. If an obstacle is detected on the right,
the robot moves back and then to the left to avoid it (approx. 30°).
If there is an obstacle on the left, the robot moves back and then to
the right (approx. 45°). The unequal number of degrees is necessary,
so that the robot can find its way out of a corner.
If an obstacle is detected directly in front, the robot should move
back and turn 90°. If the robot detects an obstacle when moving
back, it should move a short distance forward and then avoid the ob-
stacle as in the other cases.

Publicidad

Capítulos

Tabla de contenido
loading

Tabla de contenido