- :-

Topics Covered

  • Distance Sensor
  • Lesson Links

    Check Your Understanding:
    1. 1. True / False: The waitUntil command can only use the double equal sign (==) in the condition.
    2. True
      False
    3. 2. The distance sensor measures the distance of an object in which of the following?
    4. Centimeters
      Millimeters
      Meters
      Inches
    5. 3. As the robot gets closer to an object, the value of the distance sensor will do which of the following?
    6. Increases
      Decreases
      Remains the same
    Try It!
    Try it! 1

    Setting Thresholds

    Thresholds are values that set a cutoff in a range of values, so that even if there are many possibilities, the value eventually falls above the threshold, or below the threshold.

    Using thresholds allows you to perform certain behaviors depending on where a certain value (usually a sensor value) falls in relation to the threshold

    The threshold is used to determine at which point the robot should be performing a different behavior.

    Use the "Forward Until Near" program and experiment with different thresholds.

    Try it!
    Did You Know?

    Did you know?

    Get vs. Set Commands

    In ROBOTC, a number of commands will start with the words "Get" and "Set"

    A "Get" command is used when the program is retrieving a value from the robot - such as the value from a motor, sensor or system device such as a timer.

    A "Set" command is used when the program is storing a value into the robot - setting a motor speed or the value of a sensor.

    Did you know?

    Thresholds

    Distance sensors uses a concept of thresholds to determine "Close" and "Far"

    A threshold is the cross-over point where the program thinks the robot is either close or far away from an object.

    Did you know?

    Multiple Distance Sensors Interference

    Having multiple distance sensors being used simultaneously may produce unwanted values when running robots.

    Distance Sensor - Mini Challenge

    Mini Challenge 1: Shifting Maze Hands Off

    This challenge asks the user to program the robot to move from its starting area through a maze with tall, vertical walls. The walls in the maze can be adjusted so the robot needs to rely upon sensor input in order to be able to navigate successfully through the maze.

    With the Hand Off challenge, the robots are not allowed to bump into the walls. The walls must be avoided in order to successfully navigate the maze. The robot should make one pass through the maze

    Then, the walls that are designated to be adjusted should be moved. The robot should be able to run the same program and be able to successfully run through the maze a second time.

    The pattern of the turns that the robot needs to complete does not change when the walls move. Therefore, the programming of the turns does not need to change.
    • On a square table, have a starting and ending areas on the table, along with tall objects to serve as obstacles. The robot will move from the start (1), and navigate to the end (3), using its distance sensor.

    Mini Challenge PDF[ Shifting Maze Hands Off Challenge.pdf ]