- :-

Topics Covered

  • Adjusting the Turn for Angle Behavior
  • Lesson Links

    Check Your Understanding:
    1. 1. Which of the following factors contributes to the "overturning" problem?
    2. Physical momentum
      Sensor inaccuracy
      Both of the above
      None of the above
    3. 2. Which of the following workarounds can help to reduce the "overturning" problem?
    4. Replace the Gyro sensor
      Telling the robot to wait until a value that comes "before" the one you actually want
      Use a different numbered ports
      Press the cancel button as soon as it completed its turn
    Try It!
    Try it! 1

    Left Turns

    Does the same waitUntil Command block work for left turns?

    Try changing your program to turn 90 degrees to the left instead. Try it!


    Hint: To turn left, the right motor (motorB) should spin forward (positive power),
    and left motor (motorC) should spin backward (negative power).

    Make these changes to the part of your program as shown below.

     

    What happens?

    The same block works for both left and right turns, because the Wait Block is set to wait for any 90-degree change in the Gyro Sensor's reading. A 90-degree turn causes a 90-degree CHANGE in direction, regardless of whether the turn is to the left or right.

    Mini Challenge

    Mini Challenge: Square Box

    Using Gyro Sensor, you can program your robot to make more accurate turns. This means you can reduce the amount of error even if you make the robot turn multiple times in a single run!

  • Program the robot to complete a full lap around a square box, using the Gyro Sensor to control all of its turns.

  • Program the LED to turn Orange when the robot is Moving Forward, and flash Red when the robot is turning.
  • Can't remember how to control the LED's? Review it again from Page 3 of the Moving Forward chapter.

    The value 0 on the Gyro Sensor is always in reference to its original direction. If the first turn leaves the robot facing "90" degrees, what will a second 90 degree turn need to turn to?

    The second turn will need to turn until the Gyro Sensor reads 180 degrees (90+90). What about the third and fourth?

    The third turn will need to go until the Gyro Sensor reads 270 degrees, and the fourth will need to go until it has reached 360.

    + hint
    Did You Know?

    Did you know?

    How the Gyro Sensor Works
    Why can't a programmer just use the turnLeft and turnRight commands with the Gyro Sensor?
    • Both turnLeft and turnRight are controlled by degrees, time, and wheel rotations.
    • These commands must run until "completed", before moving onto the next command.
    • The setMotor command starts up a motor at a set speed, then allows robot to run the next command.

    The EV3 Gyro Sensor is a MEMS Sensor (Micro-ElectroMechanical System)