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.
Select which direction for the drivetrain to move in.
In this example, the robot will drive forward for 2 seconds, then stop.
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.
Select which direction for the drivetrain to move in.
Set how far the Drivetrain will move by entering a value, and choosing the unit of measurement (inches or millimeters).
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.
In this example, the robot will drive in reverse for 500 mm.
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.
Select which direction the Drivetrain will turn.
In this example, the robot will turn towards the left for 2 seconds, then stop.
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.
Select which direction the Drivetrain will turn.
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.
In this example, the robot turn left for 45 degrees.
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.
In this example, the robot will stop driving after 4 seconds.
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.
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.
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.
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.
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.
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.
In this example, the Drivetrain moves for 2 seconds before coasting to a stop.
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.
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.