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 |
---|---|
|
The direction in which to spin the motor:
|
# 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 |
---|---|
|
The direction in which to spin the motor:
|
|
The amount of degrees the motor will spin as a float or integer in degrees. |
|
Optional.
|
# 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 |
---|---|
|
The position to spin the motor to as a float or integer. |
|
Optional.
|
# 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 |
---|---|
|
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 |
---|---|
|
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 |
---|---|
|
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 |
---|---|
|
How the motor will stop:
|
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 |
---|---|
|
The maximum number of seconds a motor function will run before stopping and moving to the next function as an integer or float. |
|
Optional. The unit that represents the time:
|
# 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