Skip to main content

Interface IPositionalMotor

Represents an interface for controlling a positional motor.

Assembly: Meadow.Contracts.dll
View Source
Declaration
public interface IPositionalMotor : IVariableSpeedMotor, IMotor

Properties

Position

Gets the current position of the motor.

View Source
Declaration
Angle Position { get; }

MaxVelocity

Gets the maximum run velocity for the motor

View Source
Declaration
AngularVelocity MaxVelocity { get; }

Methods

GoTo(Angle, AngularVelocity, CancellationToken)

Moves the motor to the specified position with the given velocity.

View Source
Declaration
Task GoTo(Angle position, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
Meadow.Units.AnglepositionThe target position to move to.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the movement.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

GoTo(Angle, RotationDirection, AngularVelocity, CancellationToken)

Moves the motor to the specified position and direction with the given velocity.

View Source
Declaration
Task GoTo(Angle position, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
Meadow.Units.AnglepositionThe target position to move to.
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to move the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the movement.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

Run(RotationDirection, AngularVelocity, CancellationToken)

Runs the motor in the specified direction with the given velocity.

View Source
Declaration
Task Run(RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to run the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the run.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

RunFor(TimeSpan, RotationDirection, AngularVelocity, CancellationToken)

Runs the motor for a specified duration in the specified direction with the given velocity.

View Source
Declaration
Task RunFor(TimeSpan runTime, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.TimeSpanrunTimeThe duration for which to run the motor.
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to run the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the run.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

ResetPosition(CancellationToken)

Resets the position of the motor.

View Source
Declaration
Task ResetPosition(CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.

Rotate(Angle, RotationDirection, AngularVelocity, CancellationToken)

Rotates the motor by the specified angle and direction with the given velocity.

View Source
Declaration
Task Rotate(Angle amountToRotate, RotationDirection direction, AngularVelocity velocity, CancellationToken cancellationToken = default)
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
Meadow.Units.AngleamountToRotateThe angle by which to rotate the motor.
Meadow.Peripherals.RotationDirectiondirectionThe direction in which to rotate the motor.
Meadow.Units.AngularVelocityvelocityThe angular velocity of the motor during the rotation.
System.Threading.CancellationTokencancellationTokenA token to cancel the operation.