Motion#

Spin#

The Spin block is used to spin the arm or base indefinitely.

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

  spin [arm v] [up v]

Select whether to spin the arm or base.

Diagram illustrating motor control blocks for spinning and positioning an arm or base in robotics.

Select which direction for the arm or base to move in.

Diagram illustrating spin direction options for motor control in robotics programming.

In this example, the arm will spin up for 2 seconds before stopping.

  when started :: hat events
  spin [arm v] [up v]
  wait (2) seconds
  stop [arm v]

Spin For#

The Spin For block is used to spin the arm or base for a given distance.

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

  spin [arm v] [up v] for (90) [degrees v] ▶

Select whether to spin the arm or base.

Diagram illustrating the Spin For block for motor control, showing parameters for spinning arm or base a set distance.

Select which direction for the arm or base to move in.

Diagram illustrating the Spin block options for motor control in robotics, including spin direction and duration settings.

Set how far the arm or base will spin by entering a value, and choosing the unit of measurement (degrees or turns).

Icon representing the Spin For block, used to spin the arm or base for a specified distance in degrees or turns.

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

  spin [arm v] [up v] for (90) [degrees v] ◀ and don't wait

In this example, the base will spin up for 70 degrees.

  when started :: hat events
  spin [base v] [left v] for (70) [degrees v] ▶

Spin to Position#

The Spin to Position block is used to spin the arm or base to a set position.

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

  spin [arm v] to position (90) [degrees v] ▶

Select whether to spin the arm or base.

Diagram illustrating the Spin to Position motor block for controlling arm or base movement in robotics.

Set how far the arm or base will spin by entering a value, and choosing the unit of measurement (degrees or turns).

Diagram illustrating the Spin to Position block for controlling arm or base movement in degrees or turns.

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

  spin [arm v] to position (90) [degrees v] ◀ and don't wait

In this example, the arm will spin to the 120 degrees position.

  when started :: hat events
  spin [arm v] to position (120) [degrees v] ▶

Stop Motor#

The Stop Motor block is used to stop the arm or base from moving.

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

  stop [arm v]

Select whether to spin the arm or base.

Image of a block diagram illustrating the Stop Motor function in a robotics programming environment.

In this example, the arm will spin up for 2 seconds before stopping.

  when started :: hat events
  spin [arm v] [up v]
  wait (2) seconds
  stop [arm v]

Set Motor Position#

The Set Motor Position block is used to set the arm or base’s encoder position(s) to the entered value.

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

  set [arm v] position to (0) [degrees v]

Select whether to use the arm or base.

Diagram illustrating the Set Motor Position block used to set the encoder position of a motor in degrees or turns.

Set the unit of measurement to use, degrees or turns.

Diagram illustrating the Set Motor Position block for controlling motor encoder positions in degrees or turns.

In this example, the arm’s encoder position is set to 90 degrees before the arm spins to the 0 degrees position.

  when started :: hat events
  set [arm v] position to (90) [degrees v]
  set [arm v] position to (90) [degrees v] ▶ :: #4D97FF

Set Motor Velocity#

The Set Motor Velocity block is used to set the speed of the arm or base.

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

  set [arm v] velocity to (50) % :: #4D97FF

Select whether to use the arm or base.

Diagram illustrating the Set Motor Velocity block for controlling arm or base speed in robotic motion programming.

The Set Motor Velocity block will accept a range of -100% to 100%.

In this example, the arm will spin upward for 0.5 seconds before setting the arm’s velocity to 100%.

  when started :: hat events
  spin [arm v] [up v]
  wait (0.5) seconds
  set [arm v] velocity to (100) % :: #4D97FF

Set Motor Stopping#

The Set Motor Stopping block is used to set the behavior of the arm or base when they stop moving.

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

  set [arm v] stopping to [brake v]

Select whether to spin the arm or base.

Diagram illustrating the Set Motor Stopping block for controlling motor stopping behavior in robotics programming.

Select which stopping behavior to use.

The three drive stopping behaviors are as follows:

  • Brake - The arm or base will come to an immediate stop.

  • Coast - The arm or base will spin gradually to a stop.

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

Diagram illustrating the Set Motor Stopping block options: Brake, Coast, and Hold for motor control.

In this example, the arm moves up for 60 degrees before coasting to a stop.

  when started :: hat events
  [Set the arm's stopping behavior to coast.]
  set [arm v] stopping to [coast v]
  spin [arm v] [up v] for (60) [degrees v] ▶

Set Motor Max Torque#

The Set Motor Max Torque block is used to set the strength of the GO arm or base. This block accepts a range of 0% to 100%.

This is a non-waiting command and allows any subsequent commands to execute without delay.

  set [arm v] max torque to (50) %

Select whether to spin the arm or base.

Diagram illustrating motor torque settings for controlling arm or base movement in robotics programming.

In this example, the base’s torque is set to 80% before spinning to the 350 degree position.

  when started :: hat events
  set [base v] max torque to (80) %
  spin [base v] to position (350) [degrees v] ▶

Set Motor Timeout#

The Set Motor Timeout block is used to set a time limit for the GO arm or base’s movement blocks.

The arm or base’s time limit is used to prevent motion blocks that do not reach their position from preventing other blocks in the stack from running. An example of the arm or base not reaching its position is an arm or base that reaches its mechanical limit and cannot complete its movement.

This is a non-waiting command and allows any subsequent commands to execute without delay.

  set [arm v] timeout to (1) seconds

Select whether to spin the arm or base.

Diagram illustrating the Set Motor Timeout block for controlling arm or base movement time limits in robotics.

In this example, the arm is set to spin forward for 5 turns with a timeout of 1 second. The arm won’t reach the target position within 1 second, so the Spin block will automatically stop.

  when started :: hat events
  set [arm v] timeout to (1) seconds
  spin [arm v] [up v] for (5) [turns v] ▶