Motion#

Introduction#

The GO Motor can spin, hold position, and control velocity and torque with precision.

For the examples below, the configured motor will be named motor_1. They will be used in all subsequent examples throughout this API documentation when referring to Motor class methods.

Below is a list of all methods:

Actions – Control the movement of motors.

  • spin – Spins a motor in a specified direction indefinitely.

  • spin_for – Spins a motor for a specified distance.

  • spin_to_position – Spins a motor to an absolute position.

  • stop – Stops a motor.

Mutators – Change the motor’s different attributes.

  • set_velocity – Sets the default velocity for the motor.

  • set_max_torque – Sets the maximum torque for a motor.

  • set_position – Sets the motor’s position to a specific value.

  • set_stopping – Sets the stop behavior (brake, coast, or hold).

  • set_timeout – Limits how long a motor function waits before giving up if movement is blocked.

Getters – Return data from motors.

  • position – Returns a motor’s current position.

  • velocity – Returns a motor’s current velocity.

  • current – Returns the current being used by a motor.

  • is_stopped – Returns whether a motor is currently not spinning.

  • is_moving – Returns whether a motor is currently spinning.

Actions#

spin#

spin spins the motor in a specified direction indefinitely.

Usage:
motor_1.spin(direction)

Parameters

Description

direction

The direction in which to spin the motor:

  • FORWARD
  • REVERSE

# Example coming soon

spin_for#

spin_for spins the motor in a specified direction for a specific angle.

Usage:
motor_1.spin_for(direction, angle, wait)

Parameters

Description

direction

The direction in which to spin the motor:

  • FORWARD
  • REVERSE

angle

The amount of degrees the motor will spin as a float or integer in degrees.

wait

Optional.

  • wait=True (default) – The project waits until spin_for is complete before executing the next line of code.
  • wait=False - The project starts the action and moves on to the next line of code right away, without waiting for spin_for to finish.

# Example coming soon

spin_to_position#

spin_to_position spins the motor to an absolute position.

Usage:
motor_1.spin_to_position(angle, wait)

Parameters

Description

angle

The position to spin the motor to as a float or integer.

wait

Optional.

  • wait=True (default) – The project waits until spin_to_position is complete before executing the next line of code.
  • wait=False - The project starts the action and moves on to the next line of code right away, without waiting for spin_to_position to finish.

# Example coming soon

stop#

stop stops a motor from spinning.

Usage:
motor_1.stop()

Parameters

Description

This method has no parameters.

# Example coming soon

Mutators#

set_velocity#

set_velocity sets the default velocity for a motor. This velocity setting will be used for subsequent calls to any Motor functions.

Usage:
motor_1.set_velocity(velocity)

Parameters

Description

velocity

The velocity at which the motor will spin at as a percent.

# Example coming soon

set_max_torque#

set_max_torque sets the maximum torque for a motor.

Usage:
motor_1.set_max_torque(value)

Parameters

Description

value

The new maximum torque for a motor as a float or integer.

# Example coming soon

set_position#

set_position sets the position of a motor.

Usage:
motor_1.set_position(position)

Parameters

Description

position

The new position as an integer in degrees.

# Example coming soon

set_stopping#

set_stopping sets the stopping mode for a motor.

Usage:
motor_1.set_stopping(mode)

Parameters

Description

mode

How the motor will stop:

  • BRAKE – Stops immediately.
  • COAST – Slows gradually to a stop.
  • HOLD – Stops and resists movement using motor feedback.

set_timeout#

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

Note: The motor’s time limit is used to prevent motor functions that do not reach their target position from stopping the execution of the rest of the project.

Usage:
motor_1.set_timeout(value, units)

Parameters

Description

value

The maximum number of seconds a motor function will run before stopping and moving to the next function as an integer or float.

units

Optional. The unit that represents the time:

  • SECONDS
  • MSEC (default) – Milliseconds

# Example coming soon

Getters#

position#

position returns the current position of a motor as an integer or as a float in degrees.

Usage:
motor_1.position()

Parameters

Description

This method has no parameters.

# Example coming soon

velocity#

velocity returns the current velocity of a motor as an integer or as a float in percent.

Usage:
motor_1.velocity()

Parameters

Description

This method has no parameters.

# Example coming soon

current#

current returns the current of the motor in amps.

Usage:
motor_1.current()

Parameters

Description

This method has no parameters.

# Example coming soon

is_stopped#

is_stopped returns a Boolean indicating whether the motor is stopped.

  • True – The motor is stopped.

  • False – The motor is spinning.

Usage:
motor_1.is_stopped()

Parameters

Description

This method has no parameters.

# Example coming soon

is_moving#

is_moving returns a Boolean indicating whether the motor is spinning.

  • True – The motor is spinning.

  • False – The motor is stopped.

Usage:
motor_1.is_moving()

Parameters

Description

This method has no parameters.

# Example coming soon