Planning the program Pro Preview

The next level of difficulty introduces self-crossing paths and bending lines. At this stage, we’ll create our first and simplest memory-based program.

For this challenge, it is assumed that the field layout is unknown before the competition, making it impossible to hardcode a specific sequence of turns.

content picture

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #2304
  • 29 Oct 2024

The main challenge with the crossed section is that when the robot passes it, it registers turns in both directions. Later, when the robot encounters an actual turn, it may choose the wrong path since there are two registered turns. To address this, we add one variable to help the robot remember the last detected turn. This allows the robot to prioritize the most recent registered turn.

We’ll call this variable "Last Detected Turn." Instead of directly calling the turn functions in the program, we’ll use a "Prioritize Turning" function, which will choose the direction to turn based on this variable.

For readability, we haven’t used this variable to verify if a turn exists in a particular direction, as doing so would add complexity, even though it would reduce the number of command blocks. We mention this to show there are ways to enhance the program, and you should focus on understanding the method used here.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Line Following
  • 15
  • 0:00
  • 42
Image for Taking it up even more
  • 1
  • 0
  • 4
  • 3d_rotation 2