Drivetrain#

Drive#

The Drive block is used to move the Drivetrain in the specified direction forever, until a new drivetrain command is used, or the project is stopped.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A notched blue coding block with the text "drive forward" written in white. There is a dropdown menu on the right side labeled "forward.

Select which direction for the drivetrain to move in.

A notched blue coding block with a yellow highlight around it containing the text "drive forward" written in white. There is a dropdown menu on the right side labeled "forward." Below the block, an expanded dropdown menu shows the options "forward" (with a checkmark) and "reverse.

In this example, the robot will drive forward for 2 seconds, then stop.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a blue block reads "drive forward," with "forward" in a dropdown menu. Next, an orange block reads "wait 2 seconds," with the number "2" in a white oval. The sequence ends with a blue block that reads "stop driving.

Drive For#

The Drive For block is used to move the Drivetrain for a given distance.

This is can be a non-blocking or blocking block depending on if the and don’t wait option is used.

A notched blue coding block with the text "drive forward for 200 mm" written in white. There are three elements: a dropdown menu labeled "forward," the number "200" displayed in a white oval, and a dropdown menu labeled "mm." A small arrow points to the right at the end of the block.

Select which direction for the drivetrain to move in.

A notched blue coding block with a yellow highlight around it containing the text "drive forward for 200 mm" written in white. There are three elements: a dropdown menu labeled "forward," the number "200" displayed in a white oval, and a dropdown menu labeled "mm." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "forward" (with a checkmark) and "reverse.

Set how far the Drivetrain will move by entering a value, and choosing the unit of measurement (inches or millimeters).

A notched blue coding block with a yellow highlight around it containing the text "drive forward for 200 mm" written in white. There are three elements: a dropdown menu labeled "forward," the number "200" displayed in a white oval, and a dropdown menu labeled "mm." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "mm" (with a checkmark) and "inches.

By default, the Drive For block will block any subsequent blocks from executing until it’s finished. By expanding the Drive for block to show and don’t wait, blocks will continue to execute while the Drivetrain is moving.

A notched blue coding block with the text "drive forward for 200 mm and don't wait" written in white. There are three elements: a dropdown menu labeled "forward," the number "200" displayed in a white oval, and a dropdown menu labeled "mm." A small arrow points to the left before the text "and don't wait" at the end of the block.

In this example, the robot will drive in reverse for 500 mm.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a blue block reads "drive reverse for 500 mm," with "reverse" and "mm" in dropdown menus and the number "500" displayed in a white oval. A small arrow points to the right at the end of the block.

Turn#

The Turn block is used to rotate the Drivetrain forever, until a new Drivetrain block is used, or the program is stopped.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A notched blue coding block with the text "turn right" written in white. There is a dropdown menu on the right side labeled "right.

Select which direction the Drivetrain will turn.

A notched blue coding block with a yellow highlight around it containing the text "turn right" written in white. There is a dropdown menu on the right side labeled "right." Below the block, an expanded dropdown menu shows the options "left" and "right," with "right" selected and marked with a checkmark.

In this example, the robot will turn towards the left for 2 seconds, then stop.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a blue block reads "turn right," with "right" in a dropdown menu. Next, an orange block reads "wait 2 seconds," with the number "2" in a white oval. The sequence ends with a blue block that reads "stop driving.

Turn For#

The Turn For block is used to rotate the Drivetrain for a given number of degrees.

This is can be a non-blocking or blocking block depending on if the and don’t wait option is used.

A notched blue coding block with the text "turn right for 90 degrees" written in white. There are three elements: a dropdown menu labeled "right," the number "90" displayed in a white oval, and the word "degrees." A small arrow points to the right at the end of the block.

Select which direction the Drivetrain will turn.

A notched blue coding block with a yellow highlight around it containing the text "turn right for 90 degrees" written in white. There are three elements: a dropdown menu labeled "right," the number "90" displayed in a white oval, and the word "degrees." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "left" and "right," with "right" selected and marked with a checkmark.

Set how far the Drivetrain will turn by entering the number of degrees.

By default, the Turn For block will block any subsequent blocks from executing until it’s finished. By expanding the Turn For block to show and don’t wait, blocks will continue to execute while the Drivetrain is moving.

A notched blue coding block with the text "turn right for 90 degrees and don't wait" written in white. There are three elements: a dropdown menu labeled "right," the number "90" displayed in a white oval, and the word "degrees." A small arrow points to the left before the text "and don't wait" at the end of the block.

In this example, the robot turn left for 45 degrees.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a blue block reads "turn left for 45 degrees," with "left" and "degrees" in dropdown menus and the number "45" displayed in a white oval. A small arrow points to the right at the end of the block.

Stop Driving#

The Stop Driving block is used to stop the drivetrain.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A blue notched block containing the text "stop driving". The block has a protrusion on its left side and an indentation on its right side, indicating it can connect to other blocks in a sequence.

In this example, the robot will stop driving after 4 seconds.

A visual coding interface showing a sequence of four interlocked blocks. From top to bottom: a yellow "when started" block, a blue "drive forward" block with a dropdown arrow, an orange "wait 4 seconds" block, and a blue "stop driving" block. The blocks are connected vertically to represent a sequence of instructions.

Set Drive Velocity#

The Set Drive Velocity block is used to set the speed of the Drivetrain.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A blue notched block containing the text "set drive velocity to 50 %". The block has a protrusion on its left side and an indentation on its right side, indicating it can connect to other blocks in a sequence.

The Set Drive Velocity block accepts a range from 1% to 100%. The default drive velocity is 50%.

In this example, the drive velocity is set to 100% before the robot drives forward for 600 MM.

A visual coding interface showing a sequence of three interlocked blocks. From top to bottom: a yellow "when started" block, a blue "set drive velocity to 100 %" block, and a blue "drive forward for 600 mm" block with dropdown arrows for "forward" and "mm". The blocks are connected vertically to represent a sequence of instructions.

Set Turn Velocity#

The Set Turn Velocity block is used to set the speed of the Drivetrain’s turns.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A blue notched block containing the text "set turn velocity to 50 %". The block has a protrusion on its left side and an indentation on its right side, indicating it can connect to other blocks in a sequence.

The Set turn velocity block accepts a range from 1% to 100%. The default turn velocity is 50%.

In this example, the turn velocity is set to 100% before the robot turns to the left for 180 degrees.

A visual coding interface showing a sequence of three interlocked blocks. From top to bottom: a yellow "when started" block, a blue "set turn velocity to 100 %" block, and a blue "turn left for 180 degrees" block with a dropdown arrow for "left". The blocks are connected vertically to represent a sequence of instructions.

Set Drive Stopping#

The Set Drive Stopping block is used to set the behavior of the Drivetrain when the robot stops moving.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A blue notched block containing the text "set drive stopping to brake" with a dropdown arrow next to "brake". The block has protrusions on both its left and right sides, indicating it can connect to other blocks before and after it in a sequence.

Select which stopping behavior to use.

The three drive stopping behaviors are as follows:

  • brake - The Drivetrain will come to an immediate stop.

  • coast - The Drivetrain will spin gradually to a stop.

  • hold - The Drivetrain will come to an immediate stop. If the Drivetrain is rotated by an outside force, the built-in encoder will move the Drivetrain back to its initial stopped position.

A blue notched block containing the text "set drive stopping to brake" with a dropdown menu open below it. The block has a yellow outline. The dropdown menu shows three options: "brake" (selected, with a checkmark), "coast", and "hold".

In this example, the Drivetrain moves for 2 seconds before coasting to a stop.

A visual coding interface showing a sequence of interlocked blocks. The sequence starts with a yellow "when started" block, followed by a gray comment block. Next are two blue blocks: "set drive stopping to coast" and "drive forward", both with dropdowns. Another gray comment block follows. The sequence ends with an orange "wait 2 seconds" block and a blue "stop driving" block. The blocks are connected vertically to represent a sequence of instructions, with gray blocks providing comments or descriptions.

Set Drive Timeout#

The Set Drive Timeout block is used to set a time limit for Drivetrain movement commands.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A blue notched block containing the text "set drive timeout to 1 seconds". The block has protrusions on both its left and right sides, indicating it can connect to other blocks before and after it in a sequence.

The Drivetrain’s time limit is used to prevent drive blocks that do not reach their target position from blocking the execution of other blocks in the stack.

For instance, if a robot is unable to reach its target position because it encounters an obstacle like a wall, the drive block will continue running indefinitely. This would prevent any subsequent blocks in the stack from executing. By setting a time limit, the drive block will automatically stop after the specified duration, allowing the program to proceed to the next block even if the target position is not reached.

In this example, the Drivetrain is set to move forward for 25 inches with a timeout of 1 second. The robot won’t reach the target position within 1 second, so the Drive block will automatically stop, and the robot will turn right by 90 degrees.

A visual coding interface showing a sequence of interlocked blocks. From top to bottom: a yellow "when started" block, a gray comment block saying "Set drive timeout to 1 second.", a blue "set drive timeout to 1 seconds" block, a blue "drive forward for 25 inches" block with dropdowns, and a blue "turn right for 90 degrees" block. The blocks are connected vertically to represent a sequence of instructions.