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.
Select which direction for the 123 Robot to move in.
In this example, the 123 Robot will drive forward for 2 seconds, then stop.
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.
Select which direction for the 123 Robot to move in.
Set how far the 123 Robot will move by entering a value, and choosing the unit of measurement (steps or millimeters).
In this example, the robot will drive forward for 2 steps.
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.
Select which direction for the 123 Robot to move in.
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.
In this example, the 123 Robot will drive until it crashes into a wall, then it will stop driving.
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.
Select which direction the 123 Robot will turn.
In this example, the 123 Robot will turn towards the right for 2 seconds, then stop.
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.
Select which direction the 123 Robot will turn.
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.
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.
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.
In this example, the 123 Robot will turn to face 270 degrees.
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.
In this example, the 123 Robot will drive forward for 2 seconds, then 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 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.
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.
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.