EV3 basics course. Gyro Sensor. Non-intuitive, but logical. Turn back (part 3) Pro Preview

Let's explain the problem of just waiting for the Gyro sensor to detect an angle and think of why the robotics systems work like that.

  • #156
  • 01 Jan 2017
  • 3:43

English

Previously we tried to turn to 90 degrees the robot was turning to 97 degrees and we tried to return back the robot, but the program was not working and the question is why. Why wasn't the robot returning back a few degrees.

To answer this question we should again look at the program. What happens in the program? Why is it very logical but non intuitive. First, the robot turns forward with the motor and it turns right until we reach a value detected by the gyro sensor of greater than or equal to 90 degrees and then we stop. As we stop, we saw that the value returned by the sensor was about 97 degrees. This was displayed here in the block. Then we tried to turn back the motor, very slightly until we are at exactly 90 degrees and then stop. This was not working correctly. The real problem here is the following. While this motor turns, we wait for the sensor to detect a value exactly 90 degrees and it detects it, it stops and it runs again until we are at exactly 90 degrees. These 2 blocks here are running in a few milliseconds because the micro controller of the brick is quite fast and from this block to this block we have some milliseconds and that's why the moment that this block detects the value of 90 degrees is actually the moment that this block detects the value of 90 degrees and they are separated with a few milliseconds difference. That's why we don't get the chance to return back with the robot and the whole program ends. In order to solve this we must add one more wait block. We wait here for about a second for the whole program to stop, to wait

and then we return back with the motor. Let's run the program, first on the software. We turn, 93 and then we return to exactly 90.

Let's see this on the camera.

You'll now see the robot turn and then return.

You see this small turning back after the robot has stopped. Again, I'll run the program.

Now we are almost perfectly aligned to about 90 degrees. So it might be 89 or 91 and that's something that we'll explore in the next video.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Moving Straight with LEGO Mindstorms EV3 robots
  • 24
  • 102:09
  • 3
Image for Gyro Sensor Introduction
  • 5
  • 0
  • 3
  • 3d_rotation 0
Image for EV3 Basic Course. Introduction to robot programming, construction and sensor use
  • 38
  • 193:26
  • 30
Image for Gyro Sensor
  • 5
  • 0
  • 3
  • 3d_rotation 0
Image for Instructors Remote Training
  • 136
  • 280:11
  • 156
Image for Gyro Sensor
  • 4
  • 0
  • 4
  • 3d_rotation 0
Image for Instructors Remote Training
  • 136
  • 280:11
  • 156
Image for Gyro Sensor Theory
  • 4
  • 0
  • 0
  • 3d_rotation 0