- :-

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
      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

    Right Turns?

    Does the same waitUntil Command block work for right turns?

    Reverse the motor power levels in your program to turn 90 degrees to the right instead. Try it!

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

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

    What happens?
    The robot spins forever! See the next Mini-Challenge to find out why...
    Mini Challenge

    Mini Challenge 1: Right Turns!

    When the robot spins to the right, the gyro counts down, not up.
    This can even cause the Gyro values to go into the negative numbers.

    To turn 90 degrees to the right, you will need to adjust your waitUntil command so that it
    waits for the Gyro Sensor’s value to pass -90 as it counts downward.

    • If avaliable, place your robot on top of a marker that will indicate intial position.
    • Program your robot to complete a 90 degree gyro turn to the right!

    To turn to the right, run the left motor forward (positive power), and the right motor backward (negative power).

    "Passing” -90 counting downward would mean that the number has gone below -90, thus “less than -90”.

    Adjust your waitUntil command block to waitUntil the gyro is less than (<) -90.

    + hint

    Mini Challenge 2: Gyro Lap

    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!
    • Use a rectangular box or create a rectangular shape on a surface with some tape.
    • Start at one of the corners of the rectangle.
    • You can make the robot travel either clock-wise or counterclock-wise around the box.
    • Program your robot to make one full lap around the box, using the Gyro Sensor to control all of its turns.
    • Program the TouchLED to turn orange when the robot is moving forward, and blue when the robot is turning.

    Can't remember how to control the TouchLEDs? Review it again from Page 3 of the Touch Sensor 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 Gyro Sensor Works

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

    Did you know?

    turnLeft/turnRight with Gyro Sensor
    Why can't a programmer cannot 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.