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.

drive_block

Select which direction for the drivetrain to move in.

drive_direction

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

drive_example

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.

drive_for_block

Select which direction for the drivetrain to move in.

drive_for_direction

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

The Drive for block can accept decimals, integers, or numeric blocks.

drive_for_unit

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.

drive_for_wait

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

drive_for_example

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.

turn_block

Select which direction the Drivetrain will turn.

turn_direction

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

turn_example

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.

turn_for_block

Select which direction the Drivetrain will turn.

turn_for_direction

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

The Drive for block can accept decimals, integers, or numeric blocks.

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.

turn_for_wait

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

turn_for_example

Turn to heading#

The Turn to heading block is used to turn a Drivetrain to a specific heading using the built-in Gyro sensor.

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

turn_to_heading_block

The Turn to heading block turns to an absolute degree measure. This means:

  • When the robot turns clockwise past 360 degrees, the degree measure will start increasing again from 0 degrees.

  • When the robot turns counterclockwise past 0 degrees, the degree measure start decreasing again from 360 degrees.

turn_to_heading_compass

The Turn to heading block can accept decimals, integers, or numeric blocks.

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

turn_to_heading_wait

In this example, the robot will turn to face 270 degrees.

turn_to_heading_example

Turn to rotation#

The Turn to rotation block is used to turn a Drivetrain to a specific angle of rotation using the built-in Gyro sensor.

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

turn_to_rotation_block

The Turn to rotation block turns a cumulative degree measure. This means:

  • When the robot turns clockwise past the 360 degrees, the degree measure continues to increase.

  • When the robot turns counterclockwise past 0 degrees, the degree measure continues to decrease.

turn_to_rotation_compass

The Turn to rotation block can accept decimals, integers, or numeric blocks.

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

turn_to_rotation_wait

In this example, the robot will turn to 480 degrees.

turn_to_rotation_example

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.

stop_driving_block

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

stop_driving_example

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.

set_drive_velocity_block

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_drive_velocity_example

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.

set_turn_velocity_block

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_turn_velocity_example

Set drive heading#

The Set drive heading block is used to set the Drivetrain’s Gyro heading value.

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

set_drive_heading_block

The Set drive heading block can be used to set the Drivetrain’s position to any given heading. This block can be used to reset the orientation of the Drivetrain’s gyro when the heading is set to a value of 0.

The Set drive heading block can accept integers or numeric blocks.

In this example, the Drivetrain’s Gyro heading will be set to 90 degrees.

set_drive_heading_example

Set drive rotation#

The Set drive rotation block is used to set the Drivetrain’s angle of rotation.

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

set_drive_rotation_block

The Set drive rotation block can be used to set the Drivetrain’s angle of rotation to any given positive or negative value.

The Set drive rotation block can accept integers or numeric blocks.

set_drive_rotation_example