Drivetrain#

Drive#

The Drive block is used to move the 123 Robot 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 diagram for the 123 Robot, illustrating movement commands and their functionalities in a drivetrain context.

Select which direction for the 123 Robot to move in.

Diagram illustrating the Drivetrain commands for controlling the 123 Robot's movement and turning directions.

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

Diagram illustrating the Drivetrain commands for controlling the 123 Robot's movement and rotation.

Drive For#

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

This is a blocking block and does not allow subsequent blocks to trigger until it is done.

Diagram illustrating the Drivetrain blocks for controlling the 123 Robot's movement and direction.

Select which direction for the 123 Robot to move in.

Diagram illustrating the Drivetrain blocks for controlling the 123 Robot's movement and turning actions.

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

Illustration of the 123 Robot's drivetrain blocks for driving and turning commands in programming.

In this example, the robot will drive forward for 2 steps.

Flowchart illustrating the Drivetrain commands for controlling the 123 Robot's movement and turning actions.

Drive Until#

The Drive Until block is used to move the 123 Robot indefinitely until a specified condition is met.

This is a blocking block and does not allow subsequent blocks to trigger until it is done.

Diagram illustrating the Drive Until" block for the 123 Robot

Select which direction for the 123 Robot to move in.

Diagram illustrating the Drivetrain commands for the 123 Robot, including Drive Until, Turn, and Set Drive Heading blocks.

Select which behavior to use:

  • object - An object is detected by the Eye Sensor on the front of the 123 Robot.

  • crash - The 123 Robot crashes into an object or wall.

  • line - The Line Detector Sensor detects a line underneath the 123 Robot.

Diagram illustrating the Drive Until block for the 123 Robot, showing movement until a specified condition is met.

In this example, the 123 Robot will drive until it crashes into a wall, then it will stop driving.

Diagram illustrating the 123 Robot's Drivetrain commands for driving and turning operations.

Turn#

The Turn block is used to rotate the 123 Robot 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.

Image of the Drive block for the 123 Robot, illustrating movement in specified direction until a new command is issued.

Select which direction the 123 Robot will turn.

Diagram illustrating the turn direction options for the 123 Robot in a Drivetrain programming context.

In this example, the 123 Robot will turn towards the right for 2 seconds, then stop.

Diagram showing the Drivetrain commands for the 123 Robot, including Drive, Turn, and Set Drive Heading functionalities.

Turn For#

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

This is a blocking block and does not allow subsequent blocks to trigger until it is done.

Illustration of the Turn For block, showing how to rotate the 123 Robot by a specified number of degrees.

Select which direction the 123 Robot will turn.

Diagram illustrating the Turn to Heading" block for controlling the 123 Robot's direction using the Gyro sensor.

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

In this example, the 123 Robot will turn left for 45 degrees.

Diagram illustrating the Drivetrain blocks for controlling the 123 Robot's movement and turning actions.

Turn to Heading#

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

This is a blocking block and does not allow subsequent blocks to trigger until it is done.

Image of the Turn to Heading block for programming the 123 Robot's Gyro sensor to turn to a specific degree.

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

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

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

Compass icon illustrating the Turn to Heading block for the 123 Robot's Gyro sensor navigation.

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

Diagram illustrating the Turn to Heading" block for controlling the 123 Robot's orientation using a Gyro sensor.

Stop Driving#

The Stop Driving block is used to stop the 123 Robot from moving.

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

Stop Driving block for 123 Robot, used to halt movement while allowing subsequent commands to execute without delay.

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

Diagram illustrating the Drivetrain commands for controlling the 123 Robot's movement and rotation.

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.

Image illustrating the Set Drive Timeout block for the 123 Robot's Drivetrain movement commands.

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

For instance, if a 123 Robot is unable to reach its target position because it encounters an obstacle like a wall, the Drivetrain block will continue running indefinitely. This would prevent any subsequent blocks in the stack from executing. By setting a time limit, the Drivetrain block will automatically stop after the specified duration, allowing the code 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 15 steps with a timeout of 2 seconds. The 123 Robot won’t be able to reach the target position within 2 seconds, so the Drive block will automatically stop, and the robot will turn right by 90 degrees.

Example of setting drive timeout for the 123 Robot, showing movement for 15 steps with a 2-second timeout.

Set Drive Heading#

The Set Drive Heading block is used to set the Drivetrain’s Gyro Sensor’s heading value.

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

Image of the Set Drive Heading block used to set the 123 Robot's Gyro Sensor heading value to a specified degree.

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.

In this example, the Drivetrain’s Gyro Sensor’s heading will be set to 90 degrees before the 123 Robot turns to a heading of 0 degrees.

Example of setting the Drivetrain's Gyro Sensor heading to 90 degrees for the 123 Robot programming.