Table of Contents

Do Line Following with PID Until Checkpoint Detected

Description

This block starts automatic PID-based line following and continues until the robot detects the specified number of checkpoints.

How It Works

The robot repeatedly performs the following operations:

  1. Reads the five IR sensor values.
  2. Determines the position of the detected line.
  3. Calculates the line-position error.
  4. Applies the configured PID constants.
  5. Adjusts the left and right motor speeds.
  6. Checks whether a checkpoint has been detected.

When the line reaches an extreme position detected by an outer sensor, the robot can use the configured sharp-turn speeds to make a stronger correction.

Once the specified checkpoint count is reached, the robot stops the line-following operation.

Python Function – Quarky and Quarky Intellio:

lf5ir.followlinepiduntilcheckpoint(1)

Example: Set the checkpoint count to 1. The robot follows the line using PID control and stops when the first checkpoint is detected and confirmed.

Example

There are no examples documented for this article.