Smart Motor#

Introduction#

The Smart Motor blocks allow you to control and monitor individual motors or motor groups on your V5 robot. These blocks can spin, stop, or move motors to specific positions, as well as report their velocity, torque, power, and temperature.

Below is a list of available blocks:

  • spin – Spins the selected motor or motor group indefinitely.

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

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

  • stop motor – Stops a specific motor or motor group from spinning.

  • set motor velocity – Sets the speed of a motor or motor group as a percentage.

  • set motor position – Sets the position (encoder value) of a motor or motor group.

  • set motor stopping – Sets the stop behavior (brake, coast, or hold) or the motor or motor group.

  • set motor max torque – Limits the maximum torque the motor or motor group can apply.

  • set motor timeout – Limits how long a motor or motor group block waits before giving up if movement is blocked.

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

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

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

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

  • motor current – Returns the current (in amps) drawn by the motor or motor group.

  • motor power – Returns the amount of electrical power the motor or motor group is consuming in watts.

  • motor torque – Returns the amount of torque currently being applied by the motor or motor group in inch-pounds (InLb) or Newton-meters (Nm).

  • motor efficiency – Returns the current efficiency of the motor or motor group.

  • motor temperature – Returns the current temperature of the motor or motor group.

spin#

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

aria-description goes here#
  spin [Motor1 v] [forward v] 

Parameter

Description

device

The motor or motor group to use, configured in the Devices window.

direction

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

  • forward — counterclockwise
  • reverse — clockwise

aria-description goes here#
  when started
  spin [Motor1 v] [forward v]     
  wait (1) seconds    
  stop [Motor1 v]

spin for#

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

aria-description goes here#
  spin [Motor1 v] [forward v] for [90] [degrees v] ▶

Parameters

Description

device

The motor or motor group to spin, configured in the Devices window.

direction

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

  • forward — counterclockwise
  • reverse — clockwise

distance

The rotation amount, as an integer or decimal.

unit

The unit of measurement:

  • 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, expand the block to say and don’t wait.

Example

    when started
    [Spin the motor forward once, then reset.]
    spin [Motor1 v] [forward v] for (90) [degrees v] ▶
    spin [Motor1 v] [reverse v] for (90) [degrees v] ▶

spin to position#

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

aria-description goes here#
  spin [Motor1 v] to position (90) [degrees v] ▶

Parameters

Description

device

The motor or motor group to spin, configured in the Devices window.

position

The target position to spin the motor or motor group to.

unit

The unit of measurement:

  • 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, expand the block to say and don’t wait.

    when started
    [Spin the motor to the new 0 position.]
    set [Motor1 v] position to [180] [degrees v]
    spin [Motor1 v] to position [0] [degrees v] ▶

stop motor#

The stop motor block immediately stops the selected motor or motor group.

aria-description goes here#
  stop [Motor1 v]

Parameters

Description

device

The motor or motor group to stop, configured in the Devices window.

aria-description goes here#
  when started
  spin [Motor1 v] [forward v]
  wait (1) seconds
  stop [Motor1 v]

set motor position#

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

aria-description goes here#
  set [Motor1 v] position to (0) [degrees v]

Parameters

Description

device

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

position

The encoder position value to set.

unit

The unit of measurement:

  • degrees
  • turns

    when started
    [Spin the motor to the new 0 position.]
    set [Motor1 v] position to [180] [degrees v]
    spin [Motor1 v] to position [0] [degrees v] ▶

set motor velocity#

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

aria-description goes here#
  set [Motor1 v] velocity to [50] [% v]

Parameters

Description

device

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

velocity

What to set the new default velocity to for the project.

unit

The unit of measurement:

  • %
  • rpm – revolutions per minute

    when started
    [Spin forward at the default velocity.]
    spin [Motor1 v] [forward v] for [90] [turns v] ▶
    [Spin slower.]
    set [Motor1 v] velocity to (20) [% v]
    spin [Motor1 v] [reverse v] for [90] [turns v] ▶
    [Spin faster.]
    set [Motor1 v] velocity to (100) [% v]
    spin [Motor1 v] [forward v] for [90] [turns v] ▶

set motor stopping#

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

aria-description goes here#
  set [Motor1 v] stopping to [brake v]

Parameters

Description

device

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

stopping behavior

Sets how the drivetrain stops:

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

set motor max torque#

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

aria-description goes here#
  set [Motor1 v] max torque to [50] %

Parameters

Description

device

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

torque

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

set motor timeout#

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

aria-description goes here#
  set [Motor1 v] timeout to [1] seconds

Parameters

Description

device

The motor or motor group 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.

motor is done?#

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

  • True - The motor is not spinning.

  • False - The motor is spinning.

Note: This block only detects movement from blocks that can expand to show the and don’t wait option.

    <[Motor1 v] is done?>

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

Example

    when started
    [Drive forward until the motor is done spinning.]
    spin [Motor1 v] [forward v] for (200) [degrees v] ◀ and don't wait
    forever
    if <[Motor1 v] is done?> then
    stop driving
    else
    drive [forward v]

motor is spinning?#

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

  • True - The motor is spinning.

  • False - The motor is not spinning.

Note: This block only detects movement from blocks that can expand to show the and don’t wait option.

    <[Motor1 v] is spinning?>

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

Example

    when started
    [Move forward while the motor is spinning.]
    spin [Motor1 v] [forward v] for (200) [degrees v] ◀ and don't wait
    while <[Motor1 v] is spinning?>
    drive [forward v]
    end
    stop driving

motor position#

The motor position block returns the total distance the selected motor or motor group has rotated. This value can be positive or negative depending on the motor’s or motor group’s configuration.

    ([Motor1 v] position in [degrees v])

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

unit

The unit of measurement:

  • degrees
  • turns

Example

    when started
    [Display the motor's position after spinning.]
    print ([Motor1 v] position in [degrees v]) on screen ◀ and set cursor to next row
    spin [Motor1 v] [forward v]
    wait (1) seconds
    print ([Motor1 v] position in [degrees v]) on screen ▶
    stop [Motor1 v]

motor velocity#

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

    ([Motor1 v] velocity in [% v])

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

unit

The unit of measurement:

  • %
  • rpm – revolutions per minute

motor current#

The motor current block returns the amount of electrical current the motor or motor group in a range from 0.0 to 1.2 amps (amperes).

    ([Motor1 v] current in amps)

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

motor power#

The motor power block returns the amount of electrical power the motor or motor group is consuming in a range from 0.0 to 22.0 watts.

    ([Motor1 v] power in watts)

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

motor torque#

The motor torque block returns the amount of torque currently being applied by the motor or motor group in a range from 0.0 to 22.0 inch-pounds (InLb) or 0.0 to 2.1 Newton-meters (Nm).

    ([Motor1 v] torque in [InLb v])

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

unit

The unit of measurement:

  • InLb – inch-pounds
  • Nm – Newton-meters

motor efficiency#

The motor efficiency block returns the current efficiency of the motor or motor group as a percent.

    ([Motor1 v] efficiency in %)

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.

motor temperature#

The motor temperature block returns the current temperature of the motor or motor group as a percent.

    ([Motor1 v] temperature in %)

Parameters

Description

device

The motor or motor group to check, configured in the Devices window.