Motion#

Introduction#

Motor blocks can spin a motor forward or in reverse, move it to a specific position, and adjust its speed, torque, and timeout settings. They can also report encoder values to track movement and position.

Below is a list of all available blocks:

Actions – Stop and spin motors.

  • spin – Spins the selected motor indefinitely.

  • spin for – Spins a motor for a specific distance in degrees or turns.

  • spin to position – Spins a motor to a set position.

  • stop motor – Stops a specific motor from spinning.

Settings – Adjust motor settings.

Values – Check movement status.

  • motor is done? – Returns a Boolean indicating whether the motor is no longer spinning.

  • motor is spinning? – Returns a Boolean indicating whether the motor is currently spinning.

  • motor position – Returns the motor’s current rotational position in degrees or turns.

  • motor velocity – Returns the motor’s current velocity in %.

  • motor current – Returns the current drawn by the motor in %.

Actions#

spin#

The spin block spins a selected motor in a specified direction using the current motor velocity.

    spin [Motor1 v] [forward v]

Parameters

Description

motor

The motor to spin, configured in the Devices window.

direction

The direction to spin, configured in the Devices window. By default this is:

  • forward – Rotates the motor counterclockwise.
  • reverse – Rotates the motor clockwise.

Example

Example coming soon!

spin for#

The spin for block spins a selected motor for a specific amount of rotation using the current motor velocity, measured in degrees or turns.

    spin [Motor1 v] [forward v] for (90) [degrees v] ▶

Parameters

Description

motor

The motor to spin, configured in the Devices window.

direction

The direction to spin, configured in the Devices window. By default this is:

  • forward – Rotates the motor counterclockwise.
  • reverse – Rotates the motor clockwise.

distance

The rotation amount, as an integer or decimal.

unit

The unit of measurement, which can be one of the following:

  • degrees
  • turns

expanding arrow

By default, this is a waiting block, so the motor will finish moving before running the next block. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

Example coming soon!

spin to position#

The spin to position block spins a motor to a specific absolute position using the current motor velocity and motor position.

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

Parameters

Description

motor

The motor to spin, configured in the Devices window.

position

The target position to spin the motor to.

unit

The unit of measurement, which can be one of the following:

  • degrees
  • turns

expanding arrow

By default, this is a waiting block, so the motor will finish moving before running the next block. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

Example coming soon!

stop motor#

The stop motor block immediately stops the selected motor.

    stop [Motor1 v]

Parameters

Description

motor

The motor to stop, configured in the Devices window.

Example

Example coming soon!

Settings#

set motor position#

The set motor position block sets a specific position value to a motor, which updates the encoder reading.

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

Parameters

Description

motor

The motor to set the position of, configured in the Devices window.

position

The encoder position value to set.

unit

The unit of measurement, which can be one of the following:

  • degrees
  • turns

Example

Example coming soon!

set motor velocity#

The set motor velocity block sets the default spinning speed of a motor as a percentage for all subsequent Motion blocks in the project.

    set [Motor1 v] velocity to (50)%

Parameters

Description

motor

The motor to set the velocity of, configured in the Devices window.

velocity

Sets the default movement velocity from 0% to 100%.

Example

Example coming soon!

set motor stopping#

The set motor stopping block sets how a motor behaves when it stops.

    set [Motor1 v] stopping to [brake v]

Parameters

Description

motor

The motor to set the stopping behavior of, configured in the Devices window.

stopping behavior

Sets how the motor stops, which can be one of the following:

  • brake – Stops immediately.
  • coast – Slows gradually to a stop.
  • hold – Stops and resists movement using motor feedback.

Example

Example coming soon!

set motor max torque#

The set motor max torque block sets how much force a motor can exert.

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

Parameters

Description

motor

The motor to set the max torque of, configured in the Devices window.

torque

The maximum torque allowed, from 0% to 100%.

Example

Example coming soon!

set motor timeout#

The set motor timeout block sets a time limit for how long a Motor block will wait to reach its target. If the robot cannot complete the movement within the set time, it will stop automatically and continue with the next block.

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

    set [Motor1 v] timeout to (1) seconds

Parameters

Description

motor

The motor to set the timeout of, configured in the Devices window.

time

The maximum number of seconds a Motor block will run before stopping and moving to the next block.

Example

Example coming soon!

Values#

motor is done?#

The motor is done? block returns a Boolean indicating whether the motor is not spinning.

  • True - The motor is not spinning.

  • False - The motor is spinning.

    <[Motor1 v] is done?>

Parameters

Description

motor

The motor to check, configured in the Devices window.

Example

Example coming soon!

motor is spinning?#

The motor is spinning? block returns a Boolean indicating whether the motor is spinning.

  • True - The motor is spinning.

  • False - The motor is not spinning.

    <[Motor1 v] is spinning?>

Parameters

Description

motor

The motor to check, configured in the Devices window.

Example

Example coming soon!

motor position#

The motor position block returns the total distance the selected motor has rotated.

    ([Motor1 v] position in [degrees v] :: custom-motion)

Parameters

Description

motor

The motor to check, configured in the Devices window.

unit

The unit of measurement, which can be one of the following:

  • degrees
  • turns

Example

Example coming soon!

motor velocity#

The motor velocity block returns the current rotational speed of the motor in a range from -100% to 100%.

    ([Motor1 v] velocity in %)

Parameters

Description

motor

The motor to check, configured in the Devices window.

Example

Example coming soon!

motor current#

The motor current block returns the electrical current used by the motor in a range from 0% to 100%.

    ([Motor1 v] current in %)

Parameters

Description

motor

The motor to check, configured in the Devices window.

Example

Example coming soon!