В момента ресурсът е наличен само на английски

Planning the program Pro Preview

The main takeaways from today's lesson are how to alternate between following a line and performing other actions needed to complete the basic level of the line-following challenge, and how to plan your program ahead of time. Today's program will serve as a foundation to build upon for solving more advanced line-following challenges.

content picture

Необходимо е да се абонирате за FLLCasts.com, за да достъпите това видео

Абонирай се

  • #2302
  • 28 Oct 2024

Let's analyze the field and outline what's needed to solve it:

  1. First, the obvious: we need a straight line-following code that will run most of the time.
  2. Second, we need code for turning, as the line-following code alone won’t handle sharp turns effectively without moving extremely slowly.
  3. Finally, we need code to allow the robot to skip over the missing segments of the line.

Now that we know the tools we’ll need, let’s outline what each one requires to work:

  1. To follow a line, all we need is a color sensor and a line to follow. This part is straightforward; we’ll just place a sensor in the middle of the robot and align it with the line.
  2. To make the robot turn, we need a way to detect turns. For this, we’ll add two more sensors—one on the left side and one on the right side of the robot. We’ll program the robot so that if either sensor detects a line, the robot will stop following the line and turn toward the sensor that detected the turn.
  3. For the missing segments of the line, we can recognize them by the absence of a line. In this case, the robot needs to be programmed to move forward and attempt to locate the line again.

While implementing this plan, we found that on rare occasions, the robot would lose the line at high speeds. Rather than reducing the robot's speed (which would improve consistency), we added another component to the program—a "safety check". This check involves a slight turn toward the line. If the line remains undetected after the turn, then the "skip over the missing segments of the line" code is executed.

Курсове и занятия включващи този Урок

Този Урок е използван в следните курсове и занятия.

Image for Line Following
  • 15
  • 0:00
  • 42
Image for The first competition
  • 5
  • 0
  • 4
  • 3d_rotation 2